Improved JSON serialization.