dojo.fromJson vs dojo.toJson

dojo.fromJson
Parses a JSON string to return a JavaScript object.

var json = '{"a":"one","b":3,"c":true}';
var obj = dojo.fromJson(json);
console.log(obj.a, obj.b, obj.c);
>>> one 3 true

dojo.toJson
Returns a JSON serialization of an object.
// a simple object
var obj = { a:"one", b:3, c:true };

// convert it to a string:
var data = dojo.toJson(obj);
console.log(data, typeof data);
>>> {"a":"one","b":3,"c":true} string

你可能感兴趣的:(C++,c,json,C#,dojo)