注:参照ライブラリに追加する必要Newtonsoft.Json.dllを、そしてNewtonsoft.Jsonを使用して、
1 パブリック 静的 文字列 FormatJsonStr(列sourJsonStr) 2 { 3 // 格式化JSON字符串 4 動的 objx = JsonConvert.DeserializeObject(sourJsonStr)。 5 リターンFormatJsonString(objx)。 6 } 7 8 パブリック 静的 文字列 FormatJsonString(オブジェクトOBJ) 9 { 10 リターンJsonConvert.SerializeObject(OBJ、Formatting.Indented)。 11 }