Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#16669 closed enhancement (fixed)

JSON2 update

Reported by: niallkennedy's profile 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)

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

Download all attachments as: .zip

Change History (8)

@niallkennedy
14 years ago

latest JSON2

#1 @sivel
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.

#2 @sivel
14 years ago

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

#3 @niallkennedy
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:

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 14 years ago by niallkennedy (previous) (diff)

#4 @nacin
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 @sivel
14 years ago

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

#6 @azaozz
13 years ago

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

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

#7 @ocean90
13 years ago

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