Question

e.g., in Node.js, if I do this:

JSON.stringify(req); 

Then I will fail because of circulative structure.

is there any setting or way to stringify it easily and skip the circulative part of structure?

Was it helpful?

Solution

Crockford's library (see cycle.js) https://github.com/douglascrockford/JSON-js supports encoding and decoding of circular objects into json (+ jsonpath).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top