Fixed JSON circular reference handling and add tests

Fix problem with the JSON emitter that caused JSON::Syck to
complain about circular references when it saw the same object
twice.

Added the $JSON::Syck::MaxDepth flag with a default value of 512