dojo.json
Submitted by ktiedt on Tue, 07/24/2007 - 16:39.
dojo.json has been refactored into part of the Dojo Core package. Here is a list of the changes.
| New Function | Old Function |
| dojo.toJson() | dojo.json.serialize() |
dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){
// summary:
// Create a JSON serialization of an object.
// Note that this doesn't check for infinite recursion, so don't do that!
//
// it:
// an object to be serialized. Objects may define their own
// serialization via a special "__json__" or "json" function
// property. If a specialized serializer has been defined, it will
// be used as a fallback.
//
// prettyPrint:
// if true, we indent objects and arrays to make the output prettier.
// The variable dojo.toJsonIndentStr is used as the indent string
// -- to use something other than the default (tab),
// change that variable before calling dojo.toJson().
//
// _indentStr:
// private variable for recursive calls when pretty printing, do not use.
//
// return:
// a String representing the serialized version of the passed object.
} | |
| Supported in dojo.toJson() | dojo.json.register() |
| None | |
| dojo.fromJson() | dojo.json.evalJson() |
dojo.fromJson = function(/*String*/ json){
// summary:
// evaluates the passed string-form of a JSON object
// json:
// a string literal of a JSON item, for instance:
// '{ "foo": [ "bar", 1, { "baz": "thud" } ] }'
// return:
// the result of the evaluation
// FIXME: should this accept mozilla's optional second arg?
} | |
- Printer-friendly version
- Login or register to post comments
- Subscribe post
