Subj : Re: read json from file To : echicken From : Mortifis Date : Sat Jun 20 2020 09:43 pm > Re: read json from file > By: Mortifis to All on Sat Jun 20 2020 11:24:37 > Mo> I have a local json file that I'd like to search for a matching unknown > Mo> record > Mo> # without having to read in the entire object (the file has over 200,00 > Mo> records > If your file looks like this: > {"a":0,"b":1,"c":2,"d":3} > You basically need to parse the whole thing. Or write your own special > parser. > If your file is like this: > {"a":0,"b":1,"c":2,"d":3} > {"e":4,"f":5,"g":6,"h":7} > Then those are two separate JSON strings on adjacent lines. In which case > you can read the file line by line, and each line will work with > JSON.parse.sadly ... it looks like this : [ { "id": 707860, "name": "Hurzuf", "country": "UA", "coord": { "lon": 34.283333, "lat": 44.549999 } }, { "id": 519188, "name": "Novinki", "country": "RU", "coord": { "lon": 37.666668, "lat": 55.683334 } }, { "id": 1283378, "name": "Gorkhā", "country": "NP", "coord": { "lon": 84.633331, "lat": 28 } }, .... that's the 1st three records of 209,578 records ... gotta read all 209,578 records (1 million, 8 hundred 86 thousand, 2 hundred 13 lines) ? ... bleh ... lol --- þ Synchronet þ Realm of Dispair BBS - http://ephram.synchro.net:82 .