I wrote this code:
ObjectMapper mapper = new ObjectMapper();
ObjectWriter writer = mapper.writer(new DefaultPrettyPrinter());
try
{
writer.writeValue(new File(jsonFile.getAbsolutePath()), jsonData);
}
catch (IOException e)
{
}
I got result like:
{
"type" : "aaa",
"key" : {
"key1" : "bbb",
"key 2" : [ {
"value" : "xx"
}, {
"value" : "sss"
}, {
"value" : "zzz"
}]
}
}
I want the content will be:
{
"type" : "aaa",
"key" :
{
"key1" : "bbb",
"key 2" :
[
{
"value" : "xx"
},
{
"value" : "sss"
},
{
"value" : "zzz"
}
]
}
}
I want it to be with drop line in any bracket, and number of tabs compatible. How can I add line drop and appropriate tabs between Json fields?