back to Overview

$.parseJSON()

Parses a string containing JSON and returns the de-serialized object.
Web module only.

Syntax

$.parseJSON(text)

Parameters

text
the JSON string
(return value)
the resulting JavaScript object. Undefined if not valid.

Description

Parses a string containing JSON and returns the de-serialized object.

In Minified builds without Internet Explorer 7 compatibility, the browser's built-in function JSON.parse is used for de-serialization.

Only if you have a legacy-build without IE7 support, and you are actually running on IE7 or earlier, Minified will actually use its own implementation. Because of subtle differences between the browser implementation and Minified's own you need to test your code thoroughly in this constellation, but but it is a recommended security practise to use the browser implementation whenever possible.

Example

Parsing a JSON string:

var jsonString = "{name: 'Fruits', roles: ['apple', 'banana', 'orange']}";
var myObj = $.parseJSON(jsonString);

See also..

Comments

comments powered by Disqus

back to Overview

Functions