Can n8n handle 64-bit integers? (Twitter IDs)

I’m using the HTTP node to fetch information from an external API containing a Twitter Tweet ID - the field is provided as Int64, however Twitter is telling me that the ID is invalid and I’m trying to work out if the API is providing invalid data to me, or I am not handling it correctly in n8n.

Here is the Tweet ID returned by the API call:
Screen Shot 2022-10-26 at 9.11.13 AM

The ID that I see in the HTTP node is 1584997037724106800, however the correct ID for the Tweet is actually 1584997037724106798.

I found here in Twitter’s Dev docs that this appears to be a common problem, but I’m not sure which side of the API call the problem lies and hoping that this community might help to point me in the right direction!

Hi @Felix_is_stuck, n8n can’t handle such integers I am afraid as it would be limited by the max safe integer in Javascript. I do however seem to remember that most Twitter API endpoints also provide a string representation of such IDs. Could you perhaps share the full JSON data you currently have? Perhaps we can find a workaround.

Hi @MutedJam - thanks for the reply!

Here is the full JSON output returned by the HTTP request (which is not a Twitter API):

[
  {
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
      {
        "id": 17921413,
        "resource_uri": "https://www.factal.com/api/v2/item/17921413/",
        "permalink": "https://www.factal.com/item/2022/10/26/iranian-police-say-one-gunman-carried-out-attack/?redirect=true",
        "slug": "iranian-police-say-one-gunman-carried-out-attack",
        "topics": [
          {
            "item": 17921413,
            "topic": {
              "id": 2220900,
              "resource_uri": "https://www.factal.com/api/v2/topic/2220900/",
              "local_url": "/topic/protests-in-iran-over-death-of-woman-in-police-custody/",
              "permalink": "https://www.factal.com/topic/protests-in-iran-over-death-of-woman-in-police-custody/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=2220900",
              "related_topics_uri": "/api/v2/topic/?related_to=2220900",
              "slug": "protests-in-iran-over-death-of-woman-in-police-custody",
              "parents": [
                77673
              ],
              "active": true,
              "visible": true,
              "moderation_status": "needs_review",
              "name": "Protests in Iran over death of woman in police custody",
              "symbol": null,
              "created_on": "2022-09-17T09:55:54.959772Z",
              "kind": "arc",
              "category": "Incident",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "A Kurdish-Iranian woman died on Friday, Sept. 16, 2022 after being arrested by Iran's so-called \"morality police\" over the country's hijab law, sparking protests that escalated to clashes with security forces and spread to dozens of cities. More than 200 people have reportedly been killed by security forces amid those protests, according to the Norway-based NGO Iran Human Rights.",
              "wikipedia_url": "",
              "wikipedia_content_date": null,
              "latest_item_date": "2022-10-26T15:55:57.105636Z",
              "item_count": 261,
              "published_count": 261,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 30
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 2293377,
              "resource_uri": "https://www.factal.com/api/v2/topic/2293377/",
              "local_url": "/topic/incident-17920930/",
              "permalink": "https://www.factal.com/topic/incident-17920930/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=2293377",
              "related_topics_uri": "/api/v2/topic/?related_to=2293377",
              "slug": "incident-17920930",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Attack on shrine in Shiraz, Iran",
              "symbol": null,
              "created_on": "2022-10-26T15:16:51.885172Z",
              "kind": "arc",
              "category": "Incident",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "More than a dozen people were killed in an attack on a shrine in Shiraz, Iran, on Oct. 26, 2022, Iranian state media reports. Initial reports suggested three gunman attacked the shrine, with two quickly arrested.",
              "wikipedia_url": "",
              "wikipedia_content_date": null,
              "latest_item_date": "2022-10-26T15:55:57.105636Z",
              "item_count": 6,
              "published_count": 6,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 1
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 2293374,
              "resource_uri": "https://www.factal.com/api/v2/topic/2293374/",
              "local_url": "/topic/jg5vv82-district-8-shiraz-fars-province-iran/",
              "permalink": "https://www.factal.com/topic/jg5vv82-district-8-shiraz-fars-province-iran/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=2293374",
              "related_topics_uri": "/api/v2/topic/?related_to=2293374",
              "slug": "jg5vv82-district-8-shiraz-fars-province-iran",
              "parents": [
                390800,
                1661,
                391016,
                1164277,
                247481,
                1489712,
                851873
              ],
              "active": true,
              "visible": true,
              "moderation_status": "needs_wikipedia",
              "name": "JG5V+V82 District 8, Shiraz, Fars Province, Iran",
              "symbol": null,
              "created_on": "2022-10-26T15:13:36.229377Z",
              "kind": "location",
              "category": "POI",
              "googleid": "ChIJBSeZH3ANsj8RmcRylsaYawY",
              "latitude": 29.609633,
              "longitude": 52.5432731,
              "point": "SRID=4326;POINT (52.5432731 29.609633)",
              "bounding_box": "SRID=4326;POLYGON ((52.5419241197085 29.6082840197085, 52.5419241197085 29.6109819802915, 52.5446220802915 29.6109819802915, 52.5446220802915 29.6082840197085, 52.5419241197085 29.6082840197085))",
              "description": "",
              "wikipedia_url": "",
              "wikipedia_content_date": null,
              "latest_item_date": "2022-10-26T15:55:57.105636Z",
              "item_count": 6,
              "published_count": 6,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 1,
              "subscription_count": 0
            },
            "assets": [],
            "relevance": "actual",
            "impact_zone": "SRID=4326;MULTIPOLYGON (((52.55101610111449 29.60963277410703, 52.55097876601655 29.60896957750088, 52.55086722259639 29.608312772053, 52.55068254647452 29.60766868297647, 52.55042651746973 29.6070435129051, 52.55010160240903 29.60644328217, 52.54971093132747 29.60587377083584, 52.54925826728864 29.60534046305436, 52.54874797011788 29.60484849427021, 52.5481849543986 29.60440260178695, 52.54757464213662 29.60400707916818, 52.54692291054887 29.60366573491224, 52.54623603547879 29.60338185579736, 52.54552063098311 29.60315817524934, 52.54478358567025 29.60299684703595, 52.54403199640277 29.60289942454021, 52.5432731 29.60286684581182, 52.54251420359724 29.60289942454021, 52.54176261432975 29.60299684703594, 52.5410255690169 29.60315817524934, 52.54031016452121 29.60338185579736, 52.53962328945114 29.60366573491225, 52.53897155786338 29.60400707916817, 52.5383612456014 29.60440260178694, 52.53779822988212 29.60484849427021, 52.53728793271137 29.60534046305436, 52.53683526867253 29.60587377083584, 52.53644459759097 29.60644328217, 52.53611968253026 29.6070435129051, 52.53586365352547 29.60766868297647, 52.53567897740361 29.608312772053, 52.53556743398346 29.60896957750088, 52.53553009888551 29.60963277410703, 52.53556733311949 29.61029597498733, 52.5356787795518 29.61095279309338, 52.53586336628918 29.61159690272561, 52.53611931694781 29.61222210046034, 52.53644416771146 29.61282236490333, 52.53683479101601 29.61339191469456, 52.53728742563391 29.61392526420439, 52.53779771287043 29.61441727638458, 52.53836073852395 29.61486321226387, 52.53897108020686 29.61525877661098, 52.53962285957163 29.61560015932397, 52.54030979893873 29.61588407214677, 52.54102528178059 29.61610778035814, 52.54176241647794 29.61626912912726, 52.54251410273326 29.61636656428115, 52.5432731 29.61639914728368, 52.54403209726674 29.61636656428115, 52.54478378352206 29.61626912912727, 52.54552091821941 29.61610778035815, 52.54623640106128 29.61588407214677, 52.54692334042837 29.61560015932397, 52.54757511979315 29.61525877661098, 52.54818546147605 29.61486321226387, 52.54874848712957 29.61441727638457, 52.54925877436609 29.61392526420439, 52.54971140898398 29.61339191469456, 52.55010203228854 29.61282236490334, 52.5504268830522 29.61222210046034, 52.55068283371082 29.61159690272561, 52.5508674204482 29.61095279309337, 52.55097886688051 29.61029597498733, 52.55101610111449 29.60963277410703, 52.55101610111449 29.60963277410703)))",
            "impact_zone_metadata": {
              "radius": null,
              "units": null
            }
          },
          {
            "item": 17921413,
            "topic": {
              "id": 390800,
              "resource_uri": "https://www.factal.com/api/v2/topic/390800/",
              "local_url": "/topic/fars-province-iran/",
              "permalink": "https://www.factal.com/topic/fars-province-iran/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=390800",
              "related_topics_uri": "/api/v2/topic/?related_to=390800",
              "slug": "fars-province-iran",
              "parents": [
                1661,
                1164277,
                247481,
                1489712,
                851873
              ],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Fars Province, Iran",
              "symbol": null,
              "created_on": "2019-03-25T12:38:24.955988Z",
              "kind": "location",
              "category": "State",
              "googleid": "ChIJnTRELLEarT8RhL91r0hpEko",
              "latitude": 29.1043813,
              "longitude": 53.045893,
              "point": "SRID=4326;POINT (53.045893 29.1043813)",
              "bounding_box": "SRID=4326;POLYGON ((50.58247799999999 27.147872, 50.58247799999999 31.763714, 55.6170359 31.763714, 55.6170359 27.147872, 50.58247799999999 27.147872))",
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Fars_province",
              "wikipedia_content_date": "2022-10-05T06:30:51.785985Z",
              "latest_item_date": "2022-10-26T15:59:10.696122Z",
              "item_count": 75,
              "published_count": 75,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 0
            },
            "assets": [],
            "relevance": "general",
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 391016,
              "resource_uri": "https://www.factal.com/api/v2/topic/391016/",
              "local_url": "/topic/shiraz-fars-province-iran/",
              "permalink": "https://www.factal.com/topic/shiraz-fars-province-iran/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=391016",
              "related_topics_uri": "/api/v2/topic/?related_to=391016",
              "slug": "shiraz-fars-province-iran",
              "parents": [
                390800,
                1661,
                1164277,
                247481,
                1489712,
                851873
              ],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Shiraz, Fars Province, Iran",
              "symbol": null,
              "created_on": "2019-03-25T18:16:01.745372Z",
              "kind": "location",
              "category": "Town",
              "googleid": "ChIJ4_KFjAwNsj8R9kxr74pbDG0",
              "latitude": 29.5926119,
              "longitude": 52.5835646,
              "point": "SRID=4326;POINT (52.5835646 29.5926119)",
              "bounding_box": "SRID=4326;POLYGON ((52.3869324 29.4958671, 52.3869324 29.8352834, 52.6791 29.8352834, 52.6791 29.4958671, 52.3869324 29.4958671))",
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Shiraz",
              "wikipedia_content_date": "2022-10-03T15:30:37.250792Z",
              "latest_item_date": "2022-10-26T15:59:07.382805Z",
              "item_count": 43,
              "published_count": 43,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 0
            },
            "assets": [],
            "relevance": "general",
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 1661,
              "resource_uri": "https://www.factal.com/api/v2/topic/1661/",
              "local_url": "/topic/iran/",
              "permalink": "https://www.factal.com/topic/iran/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=1661",
              "related_topics_uri": "/api/v2/topic/?related_to=1661",
              "slug": "iran",
              "parents": [
                1164277,
                247481,
                1489712,
                851873
              ],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Iran",
              "symbol": null,
              "created_on": "2017-08-23T09:58:07.495378Z",
              "kind": "location",
              "category": "Country",
              "googleid": "ChIJ8R1rwS7s9z4RzvpRntOVsEA",
              "latitude": 32.427908,
              "longitude": 53.688046,
              "point": "SRID=4326;POINT (53.688046 32.427908)",
              "bounding_box": "SRID=4326;POLYGON ((44.0326949 24.8066999, 44.0326949 39.782056, 63.3333366 39.782056, 63.3333366 24.8066999, 44.0326949 24.8066999))",
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Iran",
              "wikipedia_content_date": "2022-10-05T07:30:53.886407Z",
              "latest_item_date": "2022-10-26T15:59:10.696122Z",
              "item_count": 5145,
              "published_count": 5145,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 60
            },
            "assets": [],
            "relevance": "general",
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 1489712,
              "resource_uri": "https://www.factal.com/api/v2/topic/1489712/",
              "local_url": "/topic/mena-region/",
              "permalink": "https://www.factal.com/topic/mena-region/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=1489712",
              "related_topics_uri": "/api/v2/topic/?related_to=1489712",
              "slug": "mena-region",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "MENA",
              "symbol": null,
              "created_on": "2021-05-28T16:36:08.453938Z",
              "kind": "region",
              "category": "Region",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "",
              "wikipedia_content_date": null,
              "latest_item_date": "2022-10-26T15:59:10.696122Z",
              "item_count": 23104,
              "published_count": 23104,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 69
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 1164277,
              "resource_uri": "https://www.factal.com/api/v2/topic/1164277/",
              "local_url": "/topic/asia/",
              "permalink": "https://www.factal.com/topic/asia/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=1164277",
              "related_topics_uri": "/api/v2/topic/?related_to=1164277",
              "slug": "asia",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Asia",
              "symbol": null,
              "created_on": "2020-09-30T07:13:03.717753Z",
              "kind": "region",
              "category": "Region",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "",
              "wikipedia_content_date": "2020-09-30T07:13:03Z",
              "latest_item_date": "2022-10-26T15:59:10.696122Z",
              "item_count": 58575,
              "published_count": 58575,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 62
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 851873,
              "resource_uri": "https://www.factal.com/api/v2/topic/851873/",
              "local_url": "/topic/southern-asia/",
              "permalink": "https://www.factal.com/topic/southern-asia/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=851873",
              "related_topics_uri": "/api/v2/topic/?related_to=851873",
              "slug": "southern-asia",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "Southern Asia",
              "symbol": null,
              "created_on": "2020-02-18T21:34:41.089691Z",
              "kind": "region",
              "category": "Region",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "",
              "wikipedia_content_date": null,
              "latest_item_date": "2022-10-26T15:59:10.696122Z",
              "item_count": 26639,
              "published_count": 26639,
              "recent_count": 0,
              "daily_count": 0,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 70
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 247481,
              "resource_uri": "https://www.factal.com/api/v2/topic/247481/",
              "local_url": "/topic/emea/",
              "permalink": "https://www.factal.com/topic/emea/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=247481",
              "related_topics_uri": "/api/v2/topic/?related_to=247481",
              "slug": "emea",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "EMEA",
              "symbol": null,
              "created_on": "2018-08-31T17:12:40.464968Z",
              "kind": "region",
              "category": "Region",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "",
              "wikipedia_content_date": "2021-05-26T09:41:35.862595Z",
              "latest_item_date": "2022-10-26T16:00:12.588861Z",
              "item_count": 157170,
              "published_count": 157170,
              "recent_count": 10,
              "daily_count": 41,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 138
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 60979,
              "resource_uri": "https://www.factal.com/api/v2/topic/60979/",
              "local_url": "/topic/shootings/",
              "permalink": "https://www.factal.com/topic/shootings/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=60979",
              "related_topics_uri": "/api/v2/topic/?related_to=60979",
              "slug": "shootings",
              "parents": [
                60968
              ],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "shootings",
              "symbol": "🔫",
              "created_on": "2017-12-05T19:51:56.278186Z",
              "kind": "tag",
              "category": "Subvertical",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Shooting",
              "wikipedia_content_date": "2022-10-05T18:30:56.101567Z",
              "latest_item_date": "2022-10-26T15:58:09.840032Z",
              "item_count": 45304,
              "published_count": 45304,
              "recent_count": 9,
              "daily_count": 44,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 229
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 77673,
              "resource_uri": "https://www.factal.com/api/v2/topic/77673/",
              "local_url": "/topic/protests/",
              "permalink": "https://www.factal.com/topic/protests/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=77673",
              "related_topics_uri": "/api/v2/topic/?related_to=77673",
              "slug": "protests",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "protests & civil unrest",
              "symbol": "📣",
              "created_on": "2017-12-25T06:27:41.740858Z",
              "kind": "tag",
              "category": "Subvertical",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Protest",
              "wikipedia_content_date": "2022-10-05T18:30:58.139646Z",
              "latest_item_date": "2022-10-26T15:55:57.105636Z",
              "item_count": 35252,
              "published_count": 35252,
              "recent_count": 8,
              "daily_count": 32,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 387
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          },
          {
            "item": 17921413,
            "topic": {
              "id": 60968,
              "resource_uri": "https://www.factal.com/api/v2/topic/60968/",
              "local_url": "/topic/crime-courts/",
              "permalink": "https://www.factal.com/topic/crime-courts/?redirect=true",
              "items_resource_uri": "/api/v2/item/?topics=60968",
              "related_topics_uri": "/api/v2/topic/?related_to=60968",
              "slug": "crime-courts",
              "parents": [],
              "active": true,
              "visible": true,
              "moderation_status": "approved",
              "name": "crime & courts",
              "symbol": "🚔",
              "created_on": "2017-12-05T19:45:27.710972Z",
              "kind": "vertical",
              "category": "Topic",
              "googleid": null,
              "latitude": null,
              "longitude": null,
              "point": null,
              "bounding_box": null,
              "description": "",
              "wikipedia_url": "https://en.wikipedia.org/wiki/Crime",
              "wikipedia_content_date": "2022-10-05T20:31:05.957844Z",
              "latest_item_date": "2022-10-26T16:00:11.676762Z",
              "item_count": 117972,
              "published_count": 117972,
              "recent_count": 14,
              "daily_count": 68,
              "trend_rank_last": 0,
              "trend_rank_current": 0,
              "asset_count": 0,
              "subscription_count": 185
            },
            "assets": [],
            "relevance": null,
            "impact_zone": null,
            "impact_zone_metadata": null
          }
        ],
        "tweet": null,
        "media": null,
        "feed": null,
        "url_domain": "twitter.com",
        "url": "",
        "content": "Iranian police say one gunman carried out attack on Shahcheragh Shrine in Shiraz, claim person now in interrogation; authorities earlier reported arresting two suspects and searching for third",
        "translated_content": null,
        "source": "Twitter",
        "tweet_id": "",
        "type": "text",
        "original_language": null,
        "date": "2022-10-26T15:55:57.105636Z",
        "created_date": "2022-10-26T15:55:57.105642Z",
        "updated_date": "2022-10-26T15:55:58.481888Z",
        "severity": 3,
        "status": "published",
        "submitter": "editor",
        "pushed": true,
        "pushed_major": false,
        "pushed_emerging": false,
        "tweeted": false,
        "pushed_individual": false
      }
    ]
  }
]

Apologies, above example didn’t carry a twitter id!

[
  {
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
      {
        "id": 17919896,
        "resource_uri": "https://www.factal.com/api/v2/item/17919896/",
        "permalink": "https://www.factal.com/item/2022/10/26/eyewitness-video-shows-large-amounts-of-dust-and/?redirect=true",
        "slug": "eyewitness-video-shows-large-amounts-of-dust-and",
        "tweet": null,
        "media": null,
        "feed": null,
        "url_domain": "twitter.com",
        "url": "",
        "content": "Eyewitness video shows large amounts of dust and smoke emanating from the reported building collapse in Abadan, Iran; no word on injuries",
        "translated_content": null,
        "source": "Twitter",
        "tweet_id": 1,
        "type": "text",
        "original_language": null,
        "date": "2022-10-26T13:59:41.629709Z",
        "created_date": "2022-10-26T13:59:41.629716Z",
        "updated_date": "2022-10-26T13:59:43.361083Z",
        "severity": 3,
        "status": "published",
        "submitter": "editor",
        "pushed": true,
        "pushed_major": false,
        "pushed_emerging": false,
        "tweeted": false,
        "pushed_individual": false
      },
      {
        "id": 17919873,
        "resource_uri": "https://www.factal.com/api/v2/item/17919873/",
        "permalink": "https://www.factal.com/item/2022/10/26/one-person-killed-another-injured-in-wall/?redirect=true",
        "slug": "one-person-killed-another-injured-in-wall",
        "tweet": null,
        "media": null,
        "feed": null,
        "url_domain": "twitter.com",
        "url": "",
        "content": "Local media: One person injured after getting hit in the head by rock during clashes in Santa Cruz, Bolivia, over general strikes across province due to national census delay",
        "translated_content": null,
        "source": "Twitter",
        "tweet_id": 1585267115581317000,
        "type": "text",
        "original_language": null,
        "date": "2022-10-26T13:55:15.746107Z",
        "created_date": "2022-10-26T13:55:15.746117Z",
        "updated_date": "2022-10-26T13:55:28.177080Z",
        "severity": 2,
        "status": "published",
        "submitter": "editor",
        "pushed": true,
        "pushed_major": false,
        "pushed_emerging": false,
        "tweeted": false,
        "pushed_individual": false
      }
    ]
  }
]

Hi @felix, that does look tough indeed. I think the only way to receive the data without having it changed would be to use a file response type (otherwise n8n would try to parse it automatically using the dark JavaScript magic breaking large integers):

Now we have the original data but would still need to work with it very carefully. I found this suggestion which seems to work for your data structure.

Here’s an example workflow (built using [email protected] and the new code node, if you’re using an older version of n8n you might need to upgrade first to run this):

This leaves my dummy tweet ID unchanged as it converts it (and all other integers) into a string before parsing (even though n8n doesn’t make this clear in the JSON view):

1 Like

@MutedJam thank so much for your time on this!

I can see that we’re close and capture the true integer in binary format, however the code snippet is throwing an error for me:

Hey @Felix_is_stuck,

It looks like the JSON could be the issue, It might be worth running it through an online validator to double check it.

Thanks @Jon - https://jsonlint.com is telling me it’s valid JSON…

We figured it out!

Something about the RegEx was breaking the JSON. Following the thread in the page @MutedJam linked in his post above, I modified the code to only target the tweet_id key, and turn it into a string.

const replaced_integers = $input.item.json.data.replace(new RegExp('"tweet_id":([0-9]+),',"g"),'"tweet_id":"$1",');
const parsed_text = JSON.parse(replaced_integers);

return {
  json: parsed_text
}

This worked!

2 Likes

Ah nice, that was going to be the second step. Nice to hear you have sorted it :raised_hands:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.