json class : direct member call

Description

Gets a member's value using Rice's getter call notation.

Syntax

jsonInstance.JsonObjectMemberName

Arguments

None.

Return value

ClassDescription
real,string,bool,json, or jsonnullA value of the member.

Sample code

1:

json jsonIns = new json("{@name@:@suzuki@,@age@:1}".Replace("@","".DQ)); // object

2:

string nameStr = jsonIns.name; // suzuki

3:

real ageVal = jsonIns.age; // 1.0

Notes

You can call the value corresponding to the instance member name in Rice's getter call notation.

The return value is real, string, bool, json, or jsonnull.

If the instance is an array, an exception is raised.

If the member name is the same as Rice's keyword, the keyword hides the member name and an exception is raised. In such cases, use the Get(string) method.

The above restrictions have been relaxed due to the change of syntax rules in Rice Ver 1.1.0.0. There are no restrictions on member names. That is, you can also specify keywords or class names as member names.

Links for reference

None.

Copyright © Cooker All rights reserved.