[WIP] JSON encoder refactor

# Goals

- [x] Replace `ActiveSupport`'s pure-Ruby JSON encoder with one based on the `json` gem
- [ ] Maintain backwards compatibility (`encode_json` support) by moving the old encoder into a gem
- [ ] NOT introduce significant performance degradation
- [x] Fix Rail's [`json` gem incompatibilities](https://github.com/intridea/multi_json/pull/138#issuecomment-24468223)
- [x] Fix `as_json` [not being applied recursively](https://github.com/chancancode/rails/tree/failing_tests)
 
### Nice to have

- [ ] Pluggable backend? (so that the `encode_json` gem can take advantage of that)
- [ ] Improved JSON performance
- [ ] Clean up the tests (most of the tests are testing JSON generation, should we just trust the `json` with these?)
- [ ] A guide article explaining all these JSON related stuff

### Misc TODOs
- [ ] Review all `#as_json` definitions (e.g. String#as_json should probably be #to_s instead of self, TrueClass#as_json should return true instead of self, etc)
- [ ] Ask: can we fix the json version to [>= 1.7.7](https://github.com/flori/json/blob/master/CHANGES#L11-L19)?
- [ ] Bug: encoding ActiveSupport::SafeBuffer causes infinite loop
- [ ] Figure out what to do with [this](https://github.com/rails/rails/commit/72f37bd8bc5b3beb1e8a2d1ac2de2c045cd0cfd2) ([bug](https://rails.lighthouseapp.com/projects/8994/tickets/5655)), and people who overrides `to_json` in gerenral
- [ ] Check JSON ext compat: potentially mperham/sidekiq#1070
- [ ] Check JSON pure compat: [bugs](https://gist.github.com/chancancode/579f4f8520f7301d85a3), track flori/json#183
- [ ] Check JRuby compat
- [ ] Check RBX compat
- [ ] Check multi json compat...?
- [ ] Perf test: JSON API in discourse (check with @samsaffron)
- [ ] Perf test: compiling assets
- [ ] http://hashrocket.com/blog/posts/faster-json-generation-with-postgresql / https://github.com/JackC/json_api_bench
- [ ] Close #9212 
- [ ] Check #12723