0

From an API I have data in JsonL format like:

{"id":"gid:\/\/shopify\/ProductVariant\/32620848382088","__parentId":"gid:\/\/shopify\/Product\/4632300847240"}
{"id":"gid:\/\/shopify\/Product\/4632300912776"}
{"namespace":"daily_deals","key":"status","value":"inactive","__parentId":"gid:\/\/shopify\/Product\/4632300912776"}
{"namespace":"daily_deals","key":"endtime","value":"1604966400000","__parentId":"gid:\/\/shopify\/Product\/4632300912776"}
{"id":"gid:\/\/shopify\/ProductVariant\/32620848447624","__parentId":"gid:\/\/shopify\/Product\/4632300912776"}
{"id":"gid:\/\/shopify\/Product\/4632301011080"}
{"namespace":"daily_deals","key":"status","value":"inactive","__parentId":"gid:\/\/shopify\/Product\/4632301011080"}
{"namespace":"daily_deals","key":"endtime","value":"1604966400000","__parentId":"gid:\/\/shopify\/Product\/4632301011080"}
{"id":"gid:\/\/shopify\/ProductVariant\/32620848808072","__parentId":"gid:\/\/shopify\/Product\/4632301011080"}
{"id":"gid:\/\/shopify\/ProductVariant\/39402297720968","__parentId":"gid:\/\/shopify\/Product\/4632301011080"}
{"id":"gid:\/\/shopify\/Product\/4673135444104"}

From other resources I have product ID so I need to search if JsonL file if ID is in that file and if yes to take that row.

How to do that with lowest consumption of RAM memory? Do I need to load full JSONL file convert to JSON and then search or there is a better way to do that?

Aleks Per
  • 1,549
  • 7
  • 33
  • 68
  • 1
    As you're loading from an API, you'll *already* have the full file in memory (unless your API allows you to search, in which case your question is moot). If you don't want to convert to an object, as JSON/JSONL is a string, you could use a regex. – freedomn-m Nov 09 '22 at 17:58
  • I get url where I can download JSONL ... regex could be a possible solution – Aleks Per Nov 09 '22 at 18:01
  • { "data": { "currentBulkOperation": { "id": "gid://shopify/BulkOperation/645096734742", "status": "COMPLETED", "errorCode": null, "createdAt": "2022-11-09T12:25:51Z", "completedAt": "2022-11-09T12:26:07Z", "objectCount": "2002", "fileSize": "161161", "url": "https://storage.googleapis.com/shopify-tiers-assets-prod-us-east1/elvmqzv7v6lx3ilga8o248pdd7o4?GoogleAccessId=assets-us-prod%40shopify-tiers.iam.gserviceaccount.co... ...", "partialDataUrl": null } }, – Aleks Per Nov 09 '22 at 18:04

0 Answers0