Json is a format which looks like plain text. I guess you know what you are asking. If you need to convert a file containing Json text to a readable format, you need to convert that to an Object and implement toString() method(assuming converting to Java object) to print or write to another file in a much readabe format. You can use any Json API for this, for example Jackson JSON API.
ObjectMapper obj = new ObjectMapper();
T t=obj.readValue(File src, Class<T> valueType)
t.toString(); //this must have been implemented
Answer from IndoKnight on Stack Overflow[Help] How to convert .json files to something readable by a pleb like me
Converting Json file to a human readable format? - Stack Overflow
How to print JSON String in human readable format in JS
python - How to convert json into human readable format - Stack Overflow
Videos
Json is a format which looks like plain text. I guess you know what you are asking. If you need to convert a file containing Json text to a readable format, you need to convert that to an Object and implement toString() method(assuming converting to Java object) to print or write to another file in a much readabe format. You can use any Json API for this, for example Jackson JSON API.
ObjectMapper obj = new ObjectMapper();
T t=obj.readValue(File src, Class<T> valueType)
t.toString(); //this must have been implemented
Found a suitable online JSON formatter by Curious Concept : https://jsonformatter.curiousconcept.com/
You just paste/drop your file inside and click "Process", then download the resulting beautified JSON.
Might not be a proper answer I don't know if online tools may apply, but I've found this, it solved my issue and it can be useful, so I think it's worth mentioning...
You can use pre tag to display formatted json.
const json = {
id: "1",
employee_name: "Tiger Nixon",
employee_salary: "320800",
employee_age: "61",
profile_image: ""
};
document.getElementById("app").innerHTML = JSON.stringify(json, (key, value) => (value || ''), 4).replace(/"([^"]+)":/g, '$1:');
<div><pre id="app"></pre></div>
Human.json
The best solution for you problem would be json.human. It converts JSON data in to tabular from which of course is human readable (even for non-technicle people). And the best part is it open-source.
Human.json Git-hub
I am not too sure why you want to format your Json response, it should be your service client which should do the formatting if required. You am look at the Json Pretty Printer/Beautifier Library For .Net, which takes Json string as input and return a formatted Json string.
I think no need to format it. it's very good to use compressed json. But you can still do that check this question. Otherwise write in your docs that you can use some online formatter to format json. I worked with json restfull api and I prefer to use compresses json.
- Json formatter
- Json tree viewer