jQuery.getJSON(url [, data] [, success]) (since 1.0) is a GET shorthand for loading JSON. It is equivalent to $.ajax({ dataType: "json", url, data, success }). The success callback receives a parsed object or array — no manual JSON.parse().
Pass a URL, optional query data, then handle the parsed result.
Call $.getJSON(url) with an optional data object and/or success callback.
jQuery sends a GET; data becomes a query string.
On success, the callback receives a parsed object or array.
Chain .fail() (and optionally .always()) so errors are not silent.
For JSONP, put callback=? in the URL when the API requires it.
Piece
Required?
Role
url
Yes
Endpoint that returns JSON (or JSONP)
data
Optional
Object or string → appended as query params
success
Optional
function(data, textStatus, jqXHR)
Return value
—
jqXHR Promise (.done / .fail / .always)
Pseudocode
Pseudocode
call $.getJSON(url, data?, success?)
build GET request with dataType = "json"
if data is an object:
append url-encoded query string to url
send request asynchronously
if response is valid JSON:
parse body → object or array
call success(data, textStatus, jqXHR)
resolve jqXHR → .done() handlers
else (HTTP error or bad JSON):
reject jqXHR → .fail() handlers
(bad JSON often silent unless .fail() is chained)
always → .always() handlers
Reference
Cheat Sheet
Keep these facts handy while loading JSON with jQuery.
Both GET /albums/1 as JSON
#title-a and #title-b show the same title
Prefer $.getJSON() for readability
How It Works
Same network. Both set dataType: "json" and GET the URL.
Slot difference.$.get() needs null when you skip data.
Same parse. Both success callbacks receive an object.
Choose. Use $.getJSON() when JSON is always expected.
Edge Cases & Pitfalls
Check these before relying on $.getJSON() in production.
silent
Malformed JSON often fails silently
Since jQuery 1.4, a syntax error usually skips success with no alert. Chain .fail() and validate server JSON.
cors
Same-origin still applies
Cross-domain XHR needs CORS. JSONP (callback=?) can bypass that, but it is not a modern CORS replacement.
jsonp
JSONP success args may be undefined
For JSONP / some cross-domain GETs, jqXHR and textStatus in success can be undefined — rely on the parsed data.
removed
Do not use .success() / .error()
Those jqXHR methods were removed in jQuery 3.0. Use .done(), .fail(), and .always().
strict
JSON is stricter than JS object literals
Property names and strings need double quotes. Trailing commas and single quotes break parsing.
Compatibility
Browser Support
jQuery.getJSON() has been part of jQuery since 1.0. Promise-style .done() / .fail() / .always() need jQuery 1.5+ (always since 1.6). It works in every browser that runs your loaded jQuery version.
✓ Stable · jQuery 1.0+
jQuery.getJSON()
Supported across jQuery 1.x, 2.x, and 3.x. Prefer a current jQuery 3.x build. Requires jQuery Ajax — native fetch() is a separate API.
100%With jQuery Ajax
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
getJSONUniversal
Bottom line: Safe for everyday apps. Always chain .fail() so bad JSON and HTTP errors are visible.
Analysis
Performance Notes
Approach
Cost
Best for
$.getJSON() small payload
Cheap
Typical API records / lists
Huge JSON + heavy DOM in success
Expensive
Paginate, virtualize, or stream
Debounced search getJSON
Cheap
Typeahead — abort stale jqXHR
Parsing cost scales with payload size. Keep success handlers light, and abort outdated requests during fast typing.
Remember
Key Takeaways
Role: GET shorthand with dataType: "json" — success gets a parsed value.
Errors: chain .fail() — bad JSON is often silent otherwise.
Modern: use .done() / .fail() / .always() — not removed 3.0 methods.
One line:$.getJSON() is jQuery’s one-liner for GET + parse JSON — always pair it with .fail().
Frequently Asked Questions
jQuery.getJSON() is a shorthand for $.ajax() configured as a GET with dataType "json". Pass a URL, optional data, and optional success callback — jQuery parses the response into a JavaScript object or array and returns a jqXHR Promise.
They are functionally the same. $.getJSON() presets dataType to "json"; $.get() takes "json" as a fourth argument. Prefer $.getJSON() when you always expect JSON — clearer intent, fewer arguments.
$.getJSON() expands to $.ajax({ url, data, success, dataType: "json" }). Use getJSON for a simple JSON GET. Use $.ajax() when you need headers, beforeSend, POST, global: false, or other full settings.
If the URL includes "callback=?" (or a similar server placeholder), jQuery treats the request as JSONP. That bypasses same-origin limits via a script tag. For JSONP, jqXHR and textStatus in the success callback may be undefined.
Yes — since jQuery 1.4, a JSON syntax error usually fails silently: success never runs unless you chain .fail(), use a global ajaxError handler, or handle errors another way. Always chain .fail() for user-facing requests.
A jqXHR object that implements jQuery’s Promise interface. Chain .done() for success, .fail() for errors, and .always() for either outcome. You can attach handlers after the request finishes; they still fire.