I have data in a Map object and I want to print it in a json format. I tried using DefaultPrettyPrinter
mapper.writerWithDefaultPrettyPrinter().writeValue(filePath, mapObject);
but the format is not what I expected. I am getting output like this:
{
"arrVals" : ["value-1","value-2"]
}
I want output like this:
{
"arrVals" : [
"value-1",
"value-2"
]
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…