#16669 closed enhancement (fixed)
JSON2 update
Reported by: | niallkennedy | Owned by: | |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | minor | Version: | |
Component: | External Libraries | Keywords: | has-patch |
Focuses: | Cc: |
Description
Douglas Crockford moved JSON2 to GitHub. The latest file is dated 2011-02-23 vs. the WP Core file dated 2009-08-17.
Attachments (1)
Change History (8)
#1
@
14 years ago
- Keywords 2nd-opinion added
I'm not so sure we need this. WordPress 3.2 will require PHP 5.2, which includes JSON. The 3.1 point releases wouldn't include this so, perhaps we should focus on removing the JSON lib from the WP code base.
#3
@
14 years ago
The JSON2 library is a JavaScript library to match the ECMAScript 5 compliant native JSON object included in most modern browsers.
If a piece of JavaScript code would like to interpret a string as a JavaScript object it can pass the string to JSON.parse. A JavaScript object may be converted into a string through the JSON.stringify function.
See also:
- ECMA 262 sections 15.12.2 (parse) and 15.12.3 (stringify).
- Using Native JSON in the Mozilla Developer Center.
JavaScript executes on the client-side; it is separate from server-side PHP functions json_decode and json_encode. A widget may want to retrieve JSON from a remote server and interpret the results, all via JavaScript without affecting the page cache. I might also care about a request carrying cookie data (e.g. Facebook, Twitter) for the requested domain or add data to the page that has changed since the initial page load (e.g. 2 new comments).
Language | string to object | object to string |
JavaScript | JSON.parse() | JSON.stringify() |
PHP | json_decode() | json_encode() |
#4
@
14 years ago
- Keywords 2nd-opinion removed
Yep, this is good.
On the other hand, Services_JSON will be dying a slow and painful death.
#5
@
14 years ago
Yeah, that is what I get for not paying attention and commenting without looking at the patch. </embarrassment>
latest JSON2