orgnizedmess.net · 12d · discuss
I wrote an API Client in Rust recently for EVE-NG, a network emulator. Some of its API endpoints (that represent lists of things) return different JSON representations for the same endpoint depending on the state of the instance. As Rust is strict about types, I had to figure out how to deserialize these quirks while ensuring consistency in my program. An example of this quirk is the list of nodes in a lab. When the lab has no nodes, the data is an empty array: { "data": [], } When the lab has nodes, the representation changes from an empty...