Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#16669 closed enhancement (fixed)

JSON2 update

Reported by: niallkennedy Owned by:
Priority: normal Milestone: 3.2
Component: External Libraries Version:
Severity: minor Keywords: has-patch
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)

json2.diff (7.6 KB) - added by niallkennedy 2 years ago.
latest JSON2

Download all attachments as: .zip

Change History (8)

latest JSON2

  • 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.

Oops, I think I commented without understanding what this was for...

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:

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()
Last edited 2 years ago by niallkennedy (previous) (diff)
  • Keywords 2nd-opinion removed

Yep, this is good.

On the other hand, Services_JSON will be dying a slow and painful death.

Yeah, that is what I get for not paying attention and commenting without looking at the patch. </embarrassment>

  • Resolution set to fixed
  • Status changed from new to closed

(In [17679]) Update json2.js, props niallkennedy, fixes #16669

  • Milestone changed from Awaiting Review to 3.2
Note: See TracTickets for help on using tickets.