Moved AS::JSON::DATE_REGEX as it's only used for decoding
Do not expose internal state in the public encoder API (i.e. as_json)

See [1] for why this is not a good idea.

As part of this refactor, circular reference protection in as_json has
been removed and the corresponding error class has been deprecated.

As discussed with @jeremy, circular reference error is considered
programmer errors and protecting against it is out of scope for
the encoder.

This is again based on the excellent work by @sergiocampama in #11728.

[1]: https://github.com/intridea/multi_json/pull/138#issuecomment-24468223
Merge pull request #12785 from chancancode/do_not_leak_internal_state

Do not expose internal state in the public encoder API (i.e. as_json)