{"dojo.json":{"meta":{"requires":{"common":["dojo.lang.func","dojo.string.extras","dojo.AdapterRegistry"]},"objects":{"dojo.json":{"meta":{"variables":["jsonRegistry"]},"extra":{"variables":{"jsonRegistry":{"type":"AdapterRegistry","summary":"a registry of type-based serializers"}}}}},"functions":{"dojo.json.register":{"meta":{"summary":"Register a JSON serialization function. JSON serialization functions should take one argument and return an object suitable for JSON serialization: - string - number - boolean - undefined - object - null - Array-like (length property that is a number) - Objects with a \"json\" method will have this method called - Any other object will be used as {key:value, ...} pairs If override is given, it is used as the highest priority JSON serialization, otherwise it will be used as the lowest.","parameters":{"name":{"type":"String"},"check":{"type":"function"},"wrap":{"type":"function"},"override":{"type":"optional, boolean"}},"src":"\t\tdojo.json.jsonRegistry.register(name, check, wrap, override);"},"extra":{"parameters":{"name":{"type":"a","summary":"descriptive type for this serializer"},"check":{"type":"a","summary":"unary function that will be passed an object to determine whether or not wrap will be used to serialize the object"},"wrap":{"type":"the","summary":"serialization function"},"override":{"type":"optional","summary":"determines if the this serialization function will be given priority in the test order"}}}},"dojo.json.evalJson":{"meta":{"summary":"evaluates the passed string-form of a JSON object","parameters":{"json":{"type":"String"}},"src":"\t\t\/\/ FIXME: should this accept mozilla's optional second arg?\n\t\ttry {\n\t\t\treturn eval(\"(\" + json + \")\");\n\t\t}catch(e){\n\t\t\tdojo.debug(e);\n\t\t\treturn json;\n\t\t}"},"extra":{"parameters":{"json":{"type":"a","summary":"string literal of a JSON item, for instance: '{ \"foo\": [ \"bar\", 1, { \"baz\": \"thud\" } ] }' return: the result of the evaluation"}}}},"dojo.json.serialize":{"meta":{"summary":"Create a JSON serialization of an object, note that this doesn't check for infinite recursion, so don't do that!","parameters":{"o":{"type":"Object"}},"src":"\t\tvar objtype = typeof(o);\n\t\tif(objtype == \"undefined\"){\n\t\t\treturn \"undefined\";\n\t\t}else if((objtype == \"number\")||(objtype == \"boolean\")){\n\t\t\treturn o + \"\";\n\t\t}else if(o === null){\n\t\t\treturn \"null\";\n\t\t}\n\t\tif (objtype == \"string\") { return dojo.string.escapeString(o); }\n\t\t\/\/ recurse\n\t\tvar me = arguments.callee;\n\t\t\/\/ short-circuit for objects that support \"json\" serialization\n\t\t\/\/ if they return \"self\" then just pass-through...\n\t\tvar newObj;\n\t\tif(typeof(o.__json__) == \"function\"){\n\t\t\tnewObj = o.__json__();\n\t\t\tif(o !== newObj){\n\t\t\t\treturn me(newObj);\n\t\t\t}\n\t\t}\n\t\tif(typeof(o.json) == \"function\"){\n\t\t\tnewObj = o.json();\n\t\t\tif (o !== newObj) {\n\t\t\t\treturn me(newObj);\n\t\t\t}\n\t\t}\n\t\t\/\/ array\n\t\tif(objtype != \"function\" && typeof(o.length) == \"number\"){\n\t\t\tvar res = [];\n\t\t\tfor(var i = 0; i < o.length; i++){\n\t\t\t\tvar val = me(o[i]);\n\t\t\t\tif(typeof(val) != \"string\"){\n\t\t\t\t\tval = \"undefined\";\n\t\t\t\t}\n\t\t\t\tres.push(val);\n\t\t\t}\n\t\t\treturn \"[\" + res.join(\",\") + \"]\";\n\t\t}\n\t\t\/\/ look in the registry\n\t\ttry {\n\t\t\twindow.o = o;\n\t\t\tnewObj = dojo.json.jsonRegistry.match(o);\n\t\t\treturn me(newObj);\n\t\t}catch(e){\n\t\t\t\/\/ dojo.debug(e);\n\t\t}\n\t\t\/\/ it's a function with no adapter, bad\n\t\tif(objtype == \"function\"){\n\t\t\treturn null;\n\t\t}\n\t\t\/\/ generic object code path\n\t\tres = [];\n\t\tfor (var k in o){\n\t\t\tvar useKey;\n\t\t\tif (typeof(k) == \"number\"){\n\t\t\t\tuseKey = '\"' + k + '\"';\n\t\t\t}else if (typeof(k) == \"string\"){\n\t\t\t\tuseKey = dojo.string.escapeString(k);\n\t\t\t}else{\n\t\t\t\t\/\/ skip non-string or number keys\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tval = me(o[k]);\n\t\t\tif(typeof(val) != \"string\"){\n\t\t\t\t\/\/ skip non-serializable values\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tres.push(useKey + \":\" + val);\n\t\t}\n\t\treturn \"{\" + res.join(\",\") + \"}\";"},"extra":{"parameters":{"o":{"type":"an","summary":"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. return: a String representing the serialized version of the passed object"}}}}}}}}