Bug 12784 – Add an "in" operator for std.json.JSONValue
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2014-05-21T21:16:00Z
Last change time
2014-05-22T01:49:31Z
Keywords
pull
Assigned to
nobody
Creator
markisaa
Comments
Comment #0 by markisaa — 2014-05-21T21:16:20Z
Currently the only way to check if a JSONValue (that is of type JSON_TYPE.OBJECT) contains a particular key/property is to wrap opIndex with a try catch block. This feels horribly clumsy. We should have an opBinaryRight "in" operator to allow checking without throwing.
Expect a pull request with the "fix" by end of day.