mjson icon indicating copy to clipboard operation
mjson copied to clipboard

more concise typed property values

Open bolerio opened this issue 10 years ago • 0 comments

The interface will of course fatten a bit, but that's also the point of having a single class. Instead of writing

object.at(propertyname).asString()

we could write

object.asString(propertyname)

or for arrays:

object.asString(10)

and like this for all asXXX methods.

Or drop the "as" here since we are not "at the value" yet to be say that we look at it "as something". So maybe just like this:

object.string(propname) object.bool(properyname)

that's even shorter, but the problem is new method names and less consistency with the rest of the API. Is saving a few characters worth the loss of consistency? Don't think so..

bolerio avatar Jul 13 '15 19:07 bolerio