Home

JSONElement

JSON value element

Operations

New

Constructor

New(type:JSONType)
Parameters
NameTypeDescription
typeJSONTypeJSON element type

Constructor

New(type:JSONType, value:String)
Parameters
NameTypeDescription
typeJSONTypeJSON element type
valueStringJSON string value

Constructor

New(value:String)
Parameters
NameTypeDescription
valueStringJSON string value

Constructor

New(value:Int)
Parameters
NameTypeDescription
valueIntJSON integer value

Constructor

New(value:Float)
Parameters
NameTypeDescription
valueFloatJSON float value

Constructor

New(array_elems:Vector)
Parameters
NameTypeDescription
array_elemsVectorJSON array value

Constructor

New(map_elems:StringMap)
Parameters
NameTypeDescription
map_elemsStringMapJSON object (names/values)

FindElements

Queries the object graph. Object attributes referenced by '/' while array elements are referenced by '[index]'. Example "cars/[last]/make".

method : public : FindElements(path:String) ~ JSONElement
Parameters
NameTypeDescription
pathStringquery path

Return
TypeDescription
JSONElementmatching element

Get

Gets an indexed value from an array type

method : public : Get(index:Int) ~ JSONElement
Parameters
NameTypeDescription
indexIntindex

Return
TypeDescription
JSONElementindexed value

Gets a named value from an object type

method : public : Get(name:String) ~ JSONElement
Parameters
NameTypeDescription
nameStringelement name

Return
TypeDescription
JSONElementelement value

GetNames

Gets the names of object attributes

method : public : GetNames() ~ CompareVector
Return
TypeDescription
CompareVectorobject attribute names

GetType

Gets the type

method : public : GetType() ~ JSONType
Return
TypeDescription
JSONTypetype

GetValue

Gets the value

method : public : GetValue() ~ String
Return
TypeDescription
Stringvalue

MatchType

Checks a node's type

function : public : MatchType(elem:JSONElement, type:JSONType) ~ Bool
Parameters
NameTypeDescription
elemJSONElementelement to check
typeJSONTypetype to check

Return
TypeDescription
Booltrue of matching, false otherwise

MatchValue

Checks a node's type

function : public : MatchValue(elem:JSONElement, value:String) ~ Bool
Parameters
NameTypeDescription
elemJSONElementelement to check
valueStringvalue to check

Return
TypeDescription
Booltrue of matching, false otherwise

Size

Gets the size of an array or object value

method : public : Size() ~ Int
Return
TypeDescription
Intsize of an array or object value

ToString

Format the element into a JSON string

method : public : ToString() ~ String
Return
TypeDescription
StringJSON string