使用新的System.Json from 4.5或等效的System.Json for 4.0 from Nuget如何格式化輸出,以便以更易讀的形式縮進和間隔?如何用System.Json漂亮打印?
所以這
dynamic jsonObj = new JsonObject();
jsonObj.firstName = "John";
jsonObj.lastName = "Smith";
Debug.WriteLine((string)jsonObj.ToString());
輸出這個
{"firstName":"John","lastName":"Smith"}
當我想這個
{
"firstName": "John",
"lastName": "Smith"
}