Jackson JSON Deserialization: array elements in each line

后端 未结 6 1926
野趣味
野趣味 2020-12-15 06:28

I am using Jackson and would like to pretty-print JSON such that each element in arrays goes to each line, like:

{
  \"foo\" : \"bar\",
  \"blah\" : [
    1,
             


        
6条回答
  •  轮回少年
    2020-12-15 07:12

    You could extend the DefaultPrettyPrinter and override the methods beforeArrayValues(…) and writeArrayValueSeparator(…) to archieve the desired behaviour. Afterwards you have to add your new Implementation to your JsonGenerator via setPrettyPrinter(…).

提交回复
热议问题