Home Notices Documents Classes Download Others Rice
Classes  >  json  >  Get(int)
json class : Get(int) method

Description

Gets a value corresponding to an index.

Syntax

jsonInstance.Get(int index)

Arguments

ClassNameDescription
intindexAn index.

Return value

ClassDescription
real,string,bool,json, or jsonnullA value of the array's element.

Sample code

1:

jsonIns = new json("[@name@,true,1000,null]".Replace("@","".DQ)); // array

2:

string firstVal = jsonIns.Get(0); // "name"

3:

bool secondVal = jsonIns.Get(1); // true

4:

real thirdVal = jsonIns.Get(2); // 1000.0

5:

jsonnull fourthVal = jsonIns.Get(3); // null

Notes

If the instance is an JSON object, an exception is raised.

If there is no value corresponding to the index, an exception is raised.

Only values that are direct children are searched.

Please note that the return value class is not one.

Links for reference

None

Copyright © Rice All rights reserved.