Deprecated CircularReferenceError in AS::JSON::Encoding

This is drop one of my JSON encoder refactor. This commit removed the circular reference protection as discussed with @jeremy, and as part of the refactor it also happened to fixed an encoder bugs, which I added coverage for in my second commit. I can squash them if that's preferred.

Special thanks to @sergiocampama! The refactor reused/integrated a lot of code and idea from his previous pull request.