I want to read a file containing a json-array that looks something like[{"prop1":"unique_string1","prop2":somevalue,"prop3":somevalue},{"prop1":"unique_string2","prop2":somevalue,"prop3":somevalue}] and convert it to one object that looks something like the below.{"coll": { "unique_string1": { "prop2":somevalue, "prop3":somevalue, }, {"unique_string2": { "prop2":somevalue, "prop3":somevalue, } } } } The file may be rather big so I gather streams should be used.iiuc fs.readFile('file.json', 'utf8') returns a read stream, that should be transformed like described and written to another file. But this is way out of my territory. I have some experience with rxjs but none with node streams, so appreciate help.Thanks!
Submitted May 02, 2020 at 07:25AM by granular2
No comments:
Post a Comment