JObject easily add attributes and values, or other objects to a json json object
First, combined with other objects to the property
Obj = new new a JObject a JObject ();
obj.Add ( "name", "Joe Smith");
obj.Add ( "Birthday", the DateTime.Now);
// combined with other objects to the current properties of the object
obj.Add ( " Content ", JToken.FromObject (new new
{
code =" zhangsan "
}));
Second, the combined properties of other objects, to the current object
Using the Merge () method
//合并其他
JToken token = JToken.FromObject(new
{
code = "zhangsan"
});
JObject obj2 = JObject.FromObject(new
{
code = "lisi"
});
obj.Merge(obj2);
Third, Add direct object will throw an exception: Could not determine JSON object
// add direct object failed: Could Not the Determine the JSON Object
//obj.Add(new {
// code = "zhangsan"
//});