Post

Optimizing JSON Parsing in Java

We had an API that slowed under large JSON payloads. After profiling, it turned out the bottleneck was in Jackson parsing.

Tweaks that helped:

  • Used @JsonProperty annotations to reduce reflection
  • Disabled FAIL_ON_UNKNOWN_PROPERTIES
  • Enabled stream-based parsing where applicable

Bonus: We benchmarked Jackson vs Gson vs Moshi. Jackson won for speed, but Moshi impressed with predictability.

Java may not be a “fast” language for JSON, but with the right config, you can squeeze out solid performance.

This post is licensed under CC BY 4.0 by the author.