Json.keySwitch

Selects from a set of given keys in an object and calls the corresponding delegate. The difference to singleKey when invoked with a single key is that keySwitch will not error out if the key is non-existent and may trigger the delegate multiple times, if the JSON object has duplicate keys.

struct Json(uint vl = validateUsed, bool validateUtf8 = vl > trustedSource)
void
keySwitch
(
Args...
)
(
scope void delegate
()
[Args.length]
dlg...
)
if (
vl > trustedSource ||
!validateUtf8
)

Parameters

Args

the names of the keys

dlg void delegate
()
[Args.length]

the delegates corresponding to the keys

Throws

JSONException when the key is not found in the object or parsing errors occur.

Meta