jQuery.parseJSON(json) (alias $.parseJSON) takes a well-formed JSON string and returns the matching JavaScript value (added in jQuery 1.4.1). When the browser has native JSON.parse, jQuery uses it under the hood.
Parse once, read properties, and catch errors on external data.
Start with a well-formed JSON string (double-quoted keys and strings).
Call $.parseJSON(str) — or JSON.parse(str) in new code.
Use the returned value like any object or array.
Wrap untrusted or API text in try/catch — bad JSON throws.
Piece
Required?
Role
json
Yes
Well-formed JSON string to parse
Return
—
JavaScript value (object, array, primitive, or null)
On error
—
Throws (same idea as JSON.parse)
Pseudocode
Pseudocode
function parseJSON(json):
// use native JSON.parse when available
return JSON.parse(json)
// Typical flow:
try:
data = $.parseJSON(responseText) // or JSON.parse(...)
use data.name / data.items
catch error:
handle bad JSON
Reference
Cheat Sheet
Keep these facts handy while parsing JSON with jQuery.
Native.JSON.parse is the supported replacement (and what jQuery used internally).
Migrate. Replace $.parseJSON(str) with JSON.parse(str) and keep try/catch.
Edge Cases & Pitfalls
Check these before parsing real API responses.
deprecated
Removed in jQuery 4.0
Do not start new features on $.parseJSON. Use JSON.parse so upgrades stay smooth.
quotes
JSON is stricter than JS object literals
Keys and strings need double quotes. Single quotes, trailing commas, undefined, and NaN are invalid.
control chars
Literal tabs/newlines inside strings fail
When building JSON in JS source, double backslashes ("1\\t2\\n3") so escapes survive into the JSON text.
legacy
Empty input before jQuery 1.9
Old jQuery returned null for "" / null / undefined. Modern JSON.parse("") throws — audit migrations.
Compatibility
Browser Support
jQuery.parseJSON() existed in jQuery 1.4.1–3.x and was removed in jQuery 4.0. Prefer native JSON.parse() in all modern browsers. This page focuses on browser use with jQuery loaded.
✓ Deprecated · jQuery 3.x
jQuery.parseJSON()
Available with jQuery 1.4.1–3.x in Chrome, Firefox, Safari, and Edge. Prefer JSON.parse() for new code. Not present in jQuery 4.0.
LegacyjQuery 3.x only
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.parseJSON()Legacy
Bottom line: Learn $.parseJSON() for legacy jQuery code. Write JSON.parse(str) in new projects and before upgrading to jQuery 4.
Analysis
Performance Notes
Approach
Cost
Best for
JSON.parse(str)
O(n) in string size
All new code
$.parseJSON(str)
Same (delegates to native)
Legacy jQuery 1.x–3.x only
Re-parse the same string
Wasteful
Avoid — parse once, reuse the value
Parsing cost tracks string length. Prefer one parse per response, then pass the object around. There is no speed win to keeping $.parseJSON over JSON.parse.
Remember
Key Takeaways
Role:$.parseJSON(str) → JavaScript value from JSON text.
Modern: use JSON.parse(str) instead.
Errors: malformed JSON throws — use try/catch.
Status: deprecated in 3.0, removed in 4.0.
One line: know $.parseJSON for legacy jQuery, but parse with JSON.parse and try/catch in every new project.
Frequently Asked Questions
jQuery.parseJSON(json) takes a well-formed JSON string and returns the matching JavaScript value — an object, array, string, number, boolean, or null. It was the jQuery helper for parsing JSON text before dataType: "json" and native JSON.parse were universal.
The jQuery API demo is: var obj = jQuery.parseJSON('{ "name": "John" }'); then check obj.name === "John". It parses a small JSON object and reads a property.
Both parse valid JSON into JavaScript values. When the browser provides JSON.parse, jQuery uses it internally. Prefer native JSON.parse in all new code — $.parseJSON was deprecated in jQuery 3.0 and removed in jQuery 4.0.
$.parseJSON throws a JavaScript exception (same as JSON.parse). Invalid examples include unquoted keys, single quotes, undefined, NaN, and numbers like .1 without a leading zero. Wrap external data in try/catch.
No. Use JSON.parse() for new work. Keep $.parseJSON only while maintaining jQuery 1.x–3.x legacy code. Migrate before upgrading to jQuery 4.
JSON forbids literal control characters inside strings. If a server injects a JS string with real tab/newline characters, parsing fails. Double the backslashes ("1\\t2\\n3") so the JSON text keeps the escape sequences.
Prior to jQuery 1.9, $.parseJSON returned null for an empty string, null, or undefined instead of throwing — even though those are not valid JSON. Modern JSON.parse("") throws a SyntaxError.