I have seen references to some browsers natively supporting JSON parsing/serialization of objects safely and efficiently via the window.JSON
Object, but details are hard to come by. Can anyone point in the right direction? What are the methods this Object exposes? What browsers is it supported under?
All modern browsers support native JSON encoding/decoding (Internet Explorer 8+, Firefox 3.1+, Safari 4+, and Chrome 3+). Basically, JSON.parse(str)
will parse the JSON string in str
and return an object, and JSON.stringify(obj)
will return the JSON representation of the object obj
.
More details on the MDN article.