0

Since my Google-Fu is failing me, I simply want to know:

How can I use JSONStream.stringify() to create a string containing JSON. I can find hundreds of examples that create a file, but none that simply create a string.

Edit: my usecase is that I have a large list of objects (and sometimes a small list of very large objects) which I need to turn into a JSON string. JSON.stringify cops out with a RangeError: Invalid string length, which is why I want to use JSONStream.

Wang Tang
  • 540
  • 9
  • 16
  • Does this answer your question? [How do I read the contents of a Node.js stream into a string variable?](https://stackoverflow.com/questions/10623798/how-do-i-read-the-contents-of-a-node-js-stream-into-a-string-variable) – Konrad Oct 10 '22 at 16:18
  • Thanks for looking that up but sadly it's a different scenario. I'll edit my post. – Wang Tang Oct 10 '22 at 18:42
  • 1
    Your file is too large to store it in a variable – Konrad Oct 10 '22 at 19:32

0 Answers0