What is the Jackson 2 equivalent of JSONObject?

Viewed 37354

What class in the fasterxml API is equivalent to the org.json.JSONObject?

2 Answers

Jackson 2.x

com.fasterxml.jackson.databind.node.ObjectNode

  ObjectMapper mapper = new ObjectMapper();
  ObjectNode json = mapper.createObjectNode();
  json.put("error", "json mapping error");
Related