2

I have a js file which is in json format and i want to convert this file to a human readable format.Is there any external software which does that or i have to code it??Am new to this stuff.

4

1 回答 1

1

Json 是一种看起来像纯文本的格式。我想你知道你在问什么。如果您需要将包含 Json 文本的文件转换为可读格式,则需要将其转换为 Object 并实现 toString() 方法(假设转换为 Java 对象)以非常易读的格式打印或写入另一个文件。您可以为此使用任何 Json API,例如 Jackson JSON API。

ObjectMapper obj = new ObjectMapper();
T t=obj.readValue(File src, Class<T> valueType) 

t.toString();  //this must have been implemented
于 2013-04-09T21:01:00.683 回答