Am 31.08.2013 16:16, schrieb Jack Applegame:
How to easy determine undefined JSON fields?
json.field.type == Json.Type.Undefined is too long.
For BSON we can use isNull function. What about JSON?
Json.opt is good, but isn't suitable for some cases.
Strange, I was sure that I had already replied yesterday. Anyway, the
short version:
Another possibility that does almost the same: "field" in json
The difference is for fields that are actually set, but have the type Json.Type.Undefined
, although this probably won't matter in practice.
Json.isNull
and Json.isUndefined
would also be good to have for
consistency with Bson.isNull
. I'm just slightly worried about the
added conflict potential with opDispatch
.