3 ms·
An alternative solution is don’t serialize from/deserialize to NIL. Use MY-JSON:TRUE, MY-JSON:FALSE, MY-JSON:NULL, etc. to create a perfectly bijective map. Lis
by reikonomusha 5y ago
An alternative solution is don’t serialize from/deserialize to NIL. Use MY-JSON:TRUE, MY-JSON:FALSE, MY-JSON:NULL, etc. to create a perfectly bijective map. Lisp is a symbolic language after all, no reason not to take advantage of it.
- brundolf 5y agoThat would mean writing code for each endpoint to convert its response data into the JSON-explicit format instead of dumping it out directly; this wasn't a big company and we didn't have the man-hours for that extra layer I think when they manually fixed it in individual cases, they did something like `(or the-list json:empty-array)`. We just had to encounter that case in practice and then make a Jira ticket for them to go in and patch over it, and then do that over again each and every time it came up :P The utility I wrote[1] would match JSON responses against expected schemas and report the bad `null` (or otherwise), its location in the JSON, and which service it came from, in the JS console. It didn't stop errors from reaching production but it saved a lot of time debugging. [1] https://github.com/brundonsmith/simple-typechecker https://github.com/brundonsmith/simple-typechecker