

JSON-Fu: a JSON serializer for JS/CoffeeScript (with circular reference support) - breckinloggins
https://github.com/greatfoundry/json-fu

======
breckinloggins
This is my first open-source project in a while. I created it because I wanted
something like node's inspect() but that would spit out valid JSON. The main
thing that's missing from JSON's stringify() is a depth parameter, so I added
that.

JSON.stringify() also can't handle circular references or reconstruct
reference to the same object if it occurs more than once in the JSON object,
so I added that, too.

The fancier stuff adds something called "JSON Sigils" to the JSON output,
which the deserializer can interpret. To maintain backward-compatibility with
all the other JSON code in the world, I created "serialize()" and
"deserialize()" to handle the fanciness, but made sure "stringify() and
parse()" work the way they always did (plus the depth parameter, of course).

Lastly, while I was implementing this, the internal object reference lookup
mechanism looked promising as the beginning of a "jPath"-style query
implementation, so I added some initial support for that.

I'll be using this as a base for some other projects I'm working on, so I'm
sure I'll find and fix plenty of bugs, but please feel free to create an issue
or, better yet, send me a pull request!

