可能重复:
Removing all whitespace from a string efficiently
Minify indented JSON string in .NET
我有一个这样的字符串:
{"languages" : [{"fluency": 4, "id": 15}], "address" : {"city_id" : 8341, "city_name" : "My city"}, "about" : null, "birthday" : "1988-03-18", "email" : "email@a.com", "id" : 3, "income" : 4}
我想要一个这样紧凑/缩小的字符串:
{"languages":[{"fluency":4,"id":15}],"address":{"city_id":8341,"city_name":"My city"},"about":null,"birthday":"1988-03-18","email":"email@a.com","id":3,"income":4}
注:
System.Json
在我的应用中执行序列化。我使用JsonValue
方法检索ToString ()
对象的字符串表示,但看起来我无法控制输出字符串的格式。