Home / Companies / Crowdstrike / Blog / Post Details
Content Deep Dive

Unexpected Adventures in JSON Marshaling

Blog post from Crowdstrike

Post Details
Company
Date Published
Author
Accident The
Word Count
2,802
Language
English
Hacker News Points
-
Summary

CrowdStrike faced a technical challenge when their engineering team encountered issues with storing UUID values in a PostgreSQL database using their internal csuuid library, leading to an error due to an invalid input syntax. This was resolved by extending the library to support database persistence and JSON marshaling, utilizing Go's standard library interfaces. However, this solution inadvertently caused a bug in JSON marshaling, resulting in compatibility issues across different service versions, particularly when interacting with AWS Simple Queue Service (SQS). The team discovered that the updated service was losing trace ID values, although this bug did not cause significant problems. To address the issue, they implemented a solution using a json.Decoder to support both the old and new JSON formats, ensuring backward compatibility while maintaining correct functionality. The experience highlighted the importance of considering potential breaking changes when adding new methods to a type, especially those involved in JSON marshaling, and underscored the value of exploring lower-level solutions to achieve compatibility and correctness.