c# json 排版
public static string PraseToJson(string json)
{
try
{
JsonSerializer s = new JsonSerializer();
JsonReader reader = new JsonTextReader(new StringReader(json));
Object jsonObject = s.Deserialize(reader);
StringWriter sWriter = new StringWriter();
JsonWriter writer = new JsonTextWriter(sWriter);
writer.Formatting = Formatting.Indented;
s.Serialize(writer, jsonObject);
return sWriter.ToString();
}
catch (Exception ex)
{
return json;
}
}
小川~