How to modify JsonNode in Java?

后端 未结 6 755
生来不讨喜
生来不讨喜 2020-11-28 22:29

I need to change a JSON attribute\'s value in Java, I can get the value properly but I couldn\'t modify the JSON.

here is the code below

  JsonNode          


        
6条回答
  •  天命终不由人
    2020-11-28 22:40

    I think you can just cast to ObjectNode and use put method. Like this

    ObjectNode o = (ObjectNode) jsonNode; o.put("value", "NO");

提交回复
热议问题