Java中的Pretty-Print JSON我正在使用json-simple,我需要漂亮地打印JSON数据(使其更具人性化)。我无法在该库中找到此功能。这通常是如何实现的?
3 回答

慕工程0101907
TA贡献1887条经验 获得超5个赞
我使用org.json内置方法来漂亮地打印数据。
JSONObject json = new JSONObject(jsonString); // Convert text to object
System.out.println(json.toString(4)); // Print it with specified indentation
JSON中的字段顺序是每个定义随机的。特定订单受解析器实现的影响。
添加回答
举报
0/150
提交
取消