Just Eat Feb 25, 2021

JSON Serialization Libraries Performance Comparison

Article Summary

Israel Abramov from Just Eat Takeaway tested 10 JSON serialization libraries across 8 scenarios. The results? Your default serializer might be costing you serious performance.

Most .NET developers default to Newtonsoft.Json, but it has a fundamental inefficiency: it treats UTF-8 data as UTF-16, creating unnecessary overhead. This comprehensive benchmark tested execution time, memory allocation, and CPU usage across serialization and deserialization of both simple and complex objects.

Key Takeaways

Critical Insight

Switching from Newtonsoft.Json to SpanJson, Utf8Json, or System.Text.Json can dramatically improve API performance with minimal code changes.

The article reveals which popular library causes unhandled stack overflow exceptions and why Microsoft's own legacy serializer should never be used.

Recent from Just Eat

Related Articles