As of 1.1, the JsonValue interface provides convenience methods to cast the value to JsonObject and JsonArray. Is there a reason to limit things to those two cases?
Currently, the approach to get a value via a pointer looks like:
JsonObject obj = ...;
String target = ((JsonString) obj.getValue("/some/path/0/to/my/string")).getString();
It would be slightly nicer for the following:
JsonObject obj = ...;
String target = obj.getValue("/some/path/0/to/my/string").asJsonString().getString();
Similarly, methods for asJsonNumber and asJsonBoolean, perhaps with overloads that tolerate the ValueType of NULL with a default argument.
As of 1.1, the
JsonValueinterface provides convenience methods to cast the value toJsonObjectandJsonArray. Is there a reason to limit things to those two cases?Currently, the approach to get a value via a pointer looks like:
It would be slightly nicer for the following:
Similarly, methods for
asJsonNumberandasJsonBoolean, perhaps with overloads that tolerate theValueTypeofNULLwith a default argument.