/*
* The standard way to parse JSON in JavaScript is
* [**`JSON.parse()`**][1]
*
* The [`JSON`][2] API was introduced with
* [ES5](https://en.wikipedia.org/wiki/ECMAScript#5th_Edition) (2011) and
* has since been implemented in >99% of browsers by market share, and
* Node.js. Its usage is simple:
*
* <!-- begin snippet: js hide: false console: true babel: false -->
*
* <!-- language: lang-js -->
*/
const json = '{ "fruit": "pineapple", "fingers": 10 }';
const obj = JSON.parse(json);
console.log(obj.fruit, obj.fingers);
/*
* <!-- end snippet -->
*
* ---
*
* The only time you won't be able to use `JSON.parse()` is if you are
* programming for an ancient browser, such as IE 7 (2006), IE 6 (2001),
* Firefox 3 (2008), Safari 3.x (2009), etc. Alternatively, you may be in
* an esoteric JavaScript environment that doesn't include the standard
* APIs. In these cases, use [json2.js][3], the reference implementation
* of JSON written by [Douglas Crockford][4], the inventor of JSON. That
* library will provide an implementation of `JSON.parse()`.
*
* When processing extremely large JSON files, `JSON.parse()` may choke
* because of its synchronous nature and design. To resolve this, the
* JSON website recommends third-party libraries such as [Oboe.js][5] and
* [clarinet][6], which provide streaming JSON parsing.
*
* jQuery once had a [`$.parseJSON()`][7] function, but it was deprecated
* with jQuery 3.0. In any case, for a long time, it was nothing more
* than a wrapper around `JSON.parse()`.
*
* [1]: http://msdn.microsoft.com/en-us/library/cc836466(v=vs.85).aspx
* [2]: https://developer.mozilla.org/en-
* US/docs/Web/JavaScript/Reference/Global_Objects/JSON
* [3]: https://github.com/douglascrockford/JSON-
* js/blob/master/json2.js
* [4]: https://en.wikipedia.org/wiki/Douglas_Crockford
* [5]: http://oboejs.com/
* [6]: https://github.com/dscape/clarinet
* [7]: https://api.jquery.com/jQuery.parseJSON/
*
* [Andy E] [so/q/4935632] [cc by-sa 3.0]
*/
$
cheat.sh