ruflin/Elastica — pull request #614 by mal (2014-05-13 18:48:03+00:00)
Title: JSON Compat Library

Adds a `Elastica\JSON` class which provides wrappers for `json_encode` and `json_decode`.

##### `parse` (`json_decode`)
- Default to decoding into associative arrays
- Convert parse errors to exceptions that can be caught and dealt with more intuitively

##### `stringify` (`json_encode`)
- Allow the magic string `"JSON_ELASTICSEARCH"` to be passed as `$options` to use flag settings identified for ES compatability (alternate solution to #613)

##### Other
- Removes global constant definitions :relieved:
- Two commits, in case you don't wish to use the lib everywhere (done for consistency)

---

If you're happy with this approach, I'll add some additional tests; just didn't want to spend time writing them if you opt not to go this route. Cheers!