Wednesday, 19 April 2017

Please help me write a proper JSON file

I would really appreciate any help on this issue I'm having or feedback on this code in general.

https://gist.github.com/anonymous/cbc4fe0cb3bc247d9f6e78620aca60b1

The file that this code writes ends up looking like this

[{...},{...},{...}][{...},{...},{...}]...

This is invalid JSON. How would I make sure that it's valid like this

[{...},{...},{...},{...},{...},{...}]

I've tried so many things to make it work including applying a regex to the entire file after the fact, wrapping superagent in a function that returns a promise, and editing the file after the fact in the code that relies on this script to run. All to no avail. I know there must be a better (proper?) way to do this.



via user315662

No comments:

Post a Comment