Closed fommil closed 11 years ago
@janm399 ? WhatThinkYou()
Instructions to enable
I can see where the evil lies. I hope some good pattern will emerge with #47
@janm399 the evilness is definitely that we're inspecting the String
s – certainly I can clean up the pattern matcher by using Regex
es, but I can't see a way around the fact that we're still inspecting Strings (or JsNumber
in the case of BigDecimal
).
@janm399 an alternative to the current form of inspection, of course, is that we have more complex JSON, e.g. instead of
{ "key": "2013-02-05T10:38:10+0000"}
we could follow the Mongo JSON syntax format and marshall to this
{ "key" : { "$date" : "2013-02-05T10:38:10.000Z"}}
(note milliseconds)
Anytime we ever see one of the magic $marker
s, we could invoke the correct serialiser. This might be a nice pattern, because it means we would implement a read/write/serialise/deserialise
all in one place – the Spray JSON JsonFormat
.
The downside of this approach is that the JSON endpoints will see this domain language.
If we had really fast checkers (e.g. able to work off a fixed character length, and not clashing with many other domain strings), we could potentially detect when a JSON
JsString
were actually holding aUUID
or ISO Date.This could allow us to have String based JSON marshalling, with optimal BSON serialisation.
Would have to be off by default... it is Evil™ afterall.