Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
jQuery.parseJSON: Added deprecation note for jQuery 3
Fixes gh-898
Closes gh-899
  • Loading branch information
AurelioDeRosa committed Mar 14, 2016
commit d3b74ac4c6f5b28bc6535c814c145eb73aa910fb
3 changes: 2 additions & 1 deletion entries/jQuery.parseJSON.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<entry type="method" name="jQuery.parseJSON">
<entry type="method" name="jQuery.parseJSON" deprecated="3.0">
<return type="String"/>
<return type="Number"/>
<return type="Object"/>
Expand All @@ -26,6 +26,7 @@
<p>The JSON standard does not permit "control characters" such as a tab or newline. An example like <code>$.parseJSON( '{ "testing":"1\t2\n3" }' )</code> will throw an error in most implementations because the JavaScript parser converts the string's tab and newline escapes into literal tab and newline; doubling the backslashes like <code>"1\\t2\\n3"</code> yields expected results. This problem is often seen when injecting JSON into a JavaScript file from a server-side language such as PHP.</p>
<p>Where the browser provides a native implementation of <code>JSON.parse</code>, jQuery uses it to parse the string. For details on the JSON format, see <a href="http://json.org/">http://json.org/</a>.</p>
<p>Prior to jQuery 1.9, <code>$.parseJSON</code> returned <code>null</code> instead of throwing an error if it was passed an empty string, <code>null</code>, or <code>undefined</code>, even though those are not valid JSON.</p>
<p>As of jQuery 3.0, <code>$.parseJSON</code> is deprecated. To parse JSON objects, use the native <code>JSON.parse</code> method instead.</p>
</longdesc>
<example>
<desc>Parse a JSON string.</desc>
Expand Down