NodeJS JSON.stringify of very long array of objects errors “invalid string length”

后端 未结 2 1745
自闭症患者
自闭症患者 2021-01-06 01:14

I\'ve got a very long array of objects that is about 100,000 items in size, and just before I got to write it to file, I pass the data into JSON.stringify

I get this

2条回答
  •  时光说笑
    2021-01-06 01:51

    How can I stringify a very large json object successfully?

    In parts? E.g., break the array up into smaller parts, use JSON.stringify on the smaller parts, and append each segment to the file (you'll have to do some [, ,, and ] handling).

提交回复
热议问题