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;
}
}
转载于:https://www.cnblogs.com/wlwjc/p/4939767.html