Closed ghost closed 7 years ago
@mwarnerdotme Try using the jsonexport stream feature.
Looks like your json is too big to convert in memory.
I think it had to do with scope. I moved the saveCSV method into the specific class that I was calling it from and it magically started working again. Not sure if it had to do with attaching it to the Object.prototype or if it needed to be moved to a scope within that for loop, but nonetheless it seems to me it was an issue with the scope of my method.
Either way, it works very well now. Sorry for mucking up your issue list!
@mwarnerdotme can you send working code here? I also have same issue
I'll provide some background real quick. The original JSON object has a bunch of orders in a JSON array. I loop through this array, as shown in the beginning of the first image, and use the p21ify() Promise to format the data for each individual order. Once it's formatted, I would like to save that data to a .json and a .csv file.
I have an interesting problem, though. If I use the jsonexport() function outside of the p21ify Promise shown in the attached image, it works fine. If I use it inside of this Promise, however, it gives me a call stack size error.
I've also tried JSON.stringify(this) in the jsonexport() call in the other image, but it told me that it "couldn't parse" the object. I'm pretty sure it was working earlier with a regular JS object.
Any ideas? I have a feeling that I'm going into too many layers but I'm not exactly sure how else to do it.