我正在利用JSON.net在C#中撰写一些json。 我可以生产像今天的“青/”
{
"id": "234",
"name": "abc"
}
我要做的是:
{
"DATA": {
"id": "234",
"name": "abc"
}
}
这里是json。 净代码一米
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
JsonWriter jsonWriter = new JsonTextWriter(sw);
jsonWriter.Formatting = Formatting.Indented;
jsonWriter.WriteStartObject();
jsonWriter.WritePropertyName("id");
jsonWriter.WriteValue("234");
jsonWriter.WritePropertyName("name");
jsonWriter.WriteValue("abc");
jsonWriter.WriteEndObject();
can you suggest how to add the DATA section to it?