How do I remove empty json nodes in Java with Jackson?

前端 未结 3 1897
北海茫月
北海茫月 2021-01-14 16:25

I\'m a beginning java programmer, so I\'m sorry if my question is kind of dumb.

I have a JSON object that looks like this:

{
\"element1\" : {
    \"g         


        
3条回答
  •  梦谈多话
    2021-01-14 16:46

    Check this

    How to not send an empty collection in jackson

    For empty node in Json you can use

    http://jackson.codehaus.org/1.1.2/javadoc/org/codehaus/jackson/node/ObjectNode.html#remove(java.lang.String)

    Removing JSON elements with jackson

    These can solve your problem.

提交回复
热议问题