Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Although Jackson is slower in parsing in all use cases, we have a specific use case in which Jackson parser excels due to its ability to acknowledge the data type which it is parsing. For example in CpsDataPersistenceImpl.java in the toDataNode method, we use the Jackson Object mapper to parse fragment entity attributes to a map of objects. CPS-591 implemented a bug fix to change the parser from GSON to Jackson as GSON was reading integer values as Doubles https://gerrit.onap.org/r/c/cps/+/123682

It is also widely known as the most popular JSON parsing library.

GSON

GSON is faster than Jackson mapper. However, as mentioned in the use case above, GSON is not capable of parsing well when it does not know the data type which it is mapping. It is possible to cast the incoming data to the correct datatype but it is not useful in the case where we do not know the incoming datatype. As such, in the use case mentioned above it is more practical to use the Jackson parser.

...