YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

json  2.4.1

Yahoo! UI Library > json > YAHOO.lang.JSON

Show Private Show Protected

static Class YAHOO.lang.JSON

Provides methods to parse JSON strings and convert objects to JSON strings.

Methods

parse

static MIXED parse ( s , filter )
Parse a JSON string, returning the native JavaScript representation. Only minor modifications from http://www.json.org/json.js.
Parameters:
s <string> JSON string data
filter <function> (optional) function(k,v) passed each key value pair of object literals, allowing pruning or altering values
Returns: MIXED
the native JavaScript representation of the JSON string

stringify

static string stringify ( o , w , d )
Converts an arbitrary value to a JSON string representation. Cyclical object or array references are replaced with null. If a whitelist is provided, only matching object keys will be included. If a depth limit is provided, objects and arrays at that depth will be stringified as empty.
Parameters:
o <MIXED> any arbitrary object to convert to JSON string
w <Array> (optional) whitelist of acceptable object keys to include
d <number> (optional) depth limit to recurse objects/arrays (practical minimum 1)
Returns: string
JSON string representation of the input


Copyright © 2007 Yahoo! Inc. All rights reserved.