我有以下字符串:
{"data.childData1":"s1","data.childData2":"s2",...}
如何将其转换为:
{"data":{
"childData1":"s1",
"childData2":"s2"
}
}
答案 0 :(得分:0)
您可以使用this lib来美化json,或使用Json.NET(example source):
public string GetPrettyPrintedJson(string json)
{
dynamic parsedJson = JsonConvert.DeserializeObject(json);
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
}