Could data.json support UUIDs?
Cheshire provides default formatting for UUIDs out of the box. data.json does not.
Supporting java.util.UUID by just calling str on it seems reasonable.
Applied for 2.1.0
0002-DJSON-39-Support-writing-UUIDs.patch quotes the uuid properly and has a round tripping test.
Right, sorry, I was providing the :value-fn equivalent – which data.json then converts so calling str as a :value-fn on a UUID works, but it is expecting that string to then be formatted as JSON.
I'm not sure if my comment here was understood - the uuid is being written without quotes as a json string, which is wrong.
Here it should be written as the string "\"3b17b115-cab9-49e2-93a2-1e5f55435a6f\"", not as "3b17b115-cab9-49e2-93a2-1e5f55435a6f".
This is correct:
That’s exactly what Cheshire does and exactly what our :value-fn does and it “round-trips” just fine as far as JSON is concerned (as a string).