Questions tagged [jackson]

Jackson is a Java library for handling tasks like reading and writing (parsing / generating) and data binding to/from Java objects. Although primarily used for JSON, Jackson also supports many other data formats such as Avro, CBOR, CSV, Java Properties, Protobuf, Smile, XML and YAML.

Jackson is a Java serialization and deserialization API typically used for reading and writing JSON, although other data formats such as Avro, CBOR, CSV, Java Properties, Protobuf, Smile, XML, and YAML are also supported. It offers multiple processing modes including "streaming", "data-binding" and "tree model"; of these, latter two builds on streaming processing.

The Jackson homepage is hosted on GitHub, and the project's Wiki is here.

Alternatives

Alternative Java-to-JSON binding solutions with similar APIs include FastJSON, Google Gson, and svenson. Yet more Java-to-JSON libraries are listed at json.org.

Performance

The latest performance benchmarks for these and other JSON serialization and deserialization solutions for Java are available online.

16401 questions
9
votes
1 answer

Registrer MappingJackson2HttpMessageConverter in Spring 3.1.2 with JAXB annotations

I have a number of entities with JAXB annotations that I would like to convert to JSON using a message-converter. I know that my ObjectMapper that reads the JAXB annotations works: String correctJsonText =…
molholm
  • 1,992
  • 3
  • 25
  • 29
9
votes
6 answers

How to convert json into POJO in java using jackson

I'm using spring 3.1.2 and I need to parse a json object into POJO. This is the json that I need to parse: { "Person" : { "id" : "2" }, "Dog" : { "dateOfBirth" : "2012-08-20 00:00:00", "price" : "10.00" } } I need to convert this…
Noam
  • 3,049
  • 10
  • 34
  • 52
9
votes
2 answers

Jackson - serialize/deserialize property as JSON value

Using Jackson 2, I'm looking for a generic way to be serialize objects as a single value (then serialize them back later populating only that single field) without having to repetitively create a JsonSerializer / JsonDeserializer to handle each…
jonc
  • 795
  • 1
  • 7
  • 14
9
votes
1 answer

How to map java object attribute(my_name) with json attribute (my-name)?

I am using jackson json api to map json data to java objects. All is well in case of same object attribute names with json attributes. Now i have a situation where i am getting json data attribute with -. (my-name). In java we can't include - in…
Satish Pandey
  • 1,184
  • 4
  • 12
  • 32
9
votes
2 answers

Returning a java.util.List from a Spring MVC controller via AJAX using Jackson

Based on my question posted a few days ago, I realized that SimpleFormController is inappropriate for handling Ajax requests. Therefore, I'm migrating my application towards annotated controllers. I'm trying to return a java.util.List from Oracle…
Tiny
  • 27,221
  • 105
  • 339
  • 599
9
votes
3 answers

How to prevent Jackson from outputting pretty print JSON?

I want to make sure that the JSON files generated by Jackson are never pretty print. I'm a junior working on a pre-existing project, so I need to work backwards to find out all the ways that JSON can be configured to output as pretty print. I can…
tamuren
  • 1,072
  • 4
  • 15
  • 32
9
votes
1 answer

JacksonProviderProxy writing out null values in json output

I have a simple POJO class that extends another simple POJO class. I am using the com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy to marshall the properties in these POJO classes to JSON. However, when I set some of the properties to…
Salil Surendran
  • 2,245
  • 4
  • 27
  • 42
9
votes
2 answers

Can the property @JSONIgnore be set on a per call basis?

I am working on a site that uses promo codes to potentially provide users free memberships to the site. The level that a member signs up at is an attribute of a promo code object and stored in the database as an int, either 1 or 2. However, the…
EJay
  • 1,079
  • 2
  • 12
  • 23
9
votes
1 answer

How do I give type hints to the Jackson deserializer?

I'm using Jackson as a tool to declare some objects whose classes I can't annotate (or modify at all). One of the classes has a setter and getter for an untyped list. Here's a sanitized version: public class Family { private List members; …
Mark Peters
  • 80,126
  • 17
  • 159
  • 190
9
votes
3 answers

Jackson multiple objects and huge json files

I get the feeling that the answer might be a duplicate of this: Jackson - Json to POJO With Multiple Entries but I think that potentially the question is different enough. Also I'm using raw data binding rather than full data binding. So like the…
Tom Carrick
  • 6,349
  • 13
  • 54
  • 78
8
votes
1 answer

JSON : Unrecognized field "value" (), not marked as ignorable

Can someone help me to figure out what's need to be added? JSON : {"value":{"keyword":"better","correct":"","page":0,"size":10,"cost":51,"total":1107}} Object class @JsonAutoDetect @JsonSerialize(include = Inclusion.NON_NULL) @JsonRootName(value =…
iamtheexp01
  • 3,446
  • 9
  • 35
  • 35
8
votes
3 answers

Jersey serialization/deserialization issue: abstract types can only be instantiated with additional type information

I'm using jersey for both serialization and deserialization. I've made REST channel on WebLogic using jersey. I have result object with contains abstract class. Jersey adds to the result metadata with this class'es implementation…
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
8
votes
3 answers

what is wrong with my @JsonCreator and MixIn annotation?

I'm currently using jackson 1.7 attempting to deserialize an object from a third party library. So I set up my ObjectMapper to use my mixIn class like this: ObjectMapper mapper = new ObjectMapper(); …
maverick
  • 2,185
  • 2
  • 16
  • 22
8
votes
1 answer

Dynamically ignore properties with JacksonJson

I'm aware that there are multiple way to tell JacksonJson to ignore properties during rendering but all of them are static. (JasonIgnore, MixIn classes, ..). This is my scenario. A domain object can implement a interface called FilteredDomain…
Tobias
  • 1,062
  • 1
  • 9
  • 15
8
votes
2 answers

Jackson - Properties Mapped Why Access.WRITE_ONLY Does not work?

Why Jackson not produce "propertie id"? Result run Main {id=1, name=Marcelo, email=test@gmail.com, password=123456, token=t1234, refre ...} {id=1, name=Marcelo, email=test@gmail.com, password=null, enable=true} propertie id >…
Marcelo Ferreira
  • 428
  • 1
  • 5
  • 20