To convert your object
in JSON with Jackson:
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
String json = ow.writeValueAsString(object);
More Related Contents:
- Converting JSON data to Java object
- Infinite Recursion with Jackson JSON and Hibernate JPA issue
- Configuring ObjectMapper in Spring
- Ignoring new fields on JSON objects using Jackson [duplicate]
- Only using @JsonIgnore during serialization, but not deserialization
- How can I include raw JSON in an object using Jackson?
- Jackson Vs. Gson [closed]
- Custom JSON Deserialization with Jackson
- Serializing with Jackson (JSON) – getting “No serializer found”?
- Convert JSON String to Pretty Print JSON output using Jackson
- Why when a constructor is annotated with @JsonCreator, its arguments must be annotated with @JsonProperty?
- Right way to write JSON deserializer in Spring or extend it
- How do I obtain the Jackson ObjectMapper in use by Spring 4.1?
- Jackson JSON field mapping capitalization?
- How to parse a JSON string into JsonNode in Jackson?
- Strange Jackson exception being thrown when serializing Hibernate object
- Jackson JSON library: how to instantiate a class that contains abstract fields
- How to access default jackson serialization in a custom serializer
- Jackson 3rd Party Class With No Default Constructor
- Jackson: how to prevent field serialization [duplicate]
- Merging Two JSON Documents Using Jackson
- Json and Java – Circular Reference
- Can not deserialize instance of java.util.ArrayList out of VALUE_STRING
- Enforce not-null field in JSON object
- How to compare JSON documents and return the differences with Jackson or Gson?
- Spring 3.0 making JSON response using jackson message converter
- How to annotate enum fields for deserialization using Jackson json
- Jackson Serialize Instant to Nanosecond Issue
- How to deserialize JSON into flat, Map-like structure?
- Jackson deserialize based on type