Method New ()
Creates a new empty json object.
Impressum, Datenschutzerklärung
JSON objects are collections of pairs in curly brackets, e.g. More...
Extends | |
---|---|
JsonValue |
This base class provides some fall-back functionality for the specific json value |
Constructors | |
---|---|
New () |
Creates a new empty json object. |
New ( json:String ) |
Creates a new json object from the given JSON string. |
New ( data:StringMap<JsonValue> ) |
Creates a new json object with the given data. |
Methods | |
---|---|
Contains : Bool ( key:String ) |
Returns true if the json object contains key. |
Get : JsonValue ( key:String, defval:JsonValue=null ) |
Get json value of key. |
GetBool : Int ( key:String, defval:Bool=False ) |
Get boolean value of key. |
GetData : StringMap<JsonValue> () |
Gets the internal map used to represent the object. |
GetFloat : Float ( key:String, defval:Float=0 ) |
Get float value of key. |
GetInt : Int ( key:String, defval:Int=0 ) |
Get integer value of key. |
GetString : String ( key:String, defval:String="" ) |
Get string value of key. |
Set : Void ( key:String, value:JsonValue ) |
Set key to specific value. |
SetBool : Void ( key:String, value:Bool ) |
Set key to boolean value. |
SetFloat : Void ( key:String, value:Float ) |
Set key to float value. |
SetInt : Void ( key:String, value:Int ) |
Set key to integer value. |
SetString : Void ( key:String, value:String ) |
Set key to string value. |
Inherited Properties | |
---|---|
Type : Int () |
Indicates the type of the specific JsonValue object. |
Inherited Methods | |
---|---|
BoolValue : Bool () |
For a JsonBool, this will return its boolean value. |
FloatValue : Float () |
For a JsonNumber, this will return its numerical value as float. |
IntValue : Int () |
For a JsonNumber, this will return its numerical value as int. |
StringValue : String () |
For a JsonString, this will return its string value. |
ToJson : String () |
Converts value to a JSON string. |
JSON objects are collections of pairs in curly brackets, e.g.
{
"foo"
:
"bar"
,
"answer"
:
42
}
Method New ()
Creates a new empty json object.
Method New ( json:String )
Creates a new json object from the given JSON string.
Throws a JsonError if json is invalid.
Method New ( data:StringMap<JsonValue> )
Creates a new json object with the given data.
Method Contains : Bool ( key:String )
Returns true if the json object contains key.
Method Get : JsonValue ( key:String, defval:JsonValue=null )
Get json value of key.
Returns defval if key doesn't exist.
Returns a JsonNull object if key is mapped to null.
Method GetBool : Int ( key:String, defval:Bool=False )
Get boolean value of key.
Returns defval if key doesn't exist.
Throws a JsonError if value mapped to key is not a JsonBool.
Method GetData : StringMap<JsonValue> ()
Gets the internal map used to represent the object.
To iterate through the map, use
For Local
node
:=
Eachin
json
.
GetData
()
Print node
.
Key
() +
" : "
+
node
.
Value
().
ToJson
()
End
Method GetFloat : Float ( key:String, defval:Float=0 )
Get float value of key.
Returns defval if key doesn't exist.
Throws a JsonError if value mapped to key is not a JsonNumber.
Method GetInt : Int ( key:String, defval:Int=0 )
Get integer value of key.
Returns defval if key doesn't exist.
Throws a JsonError if value mapped to key is not a JsonNumber.
Method GetString : String ( key:String, defval:String="" )
Get string value of key.
Returns defval if key doesn't exist.
Throws a JsonError if value mapped to key is not a JsonString.
Method Set : Void ( key:String, value:JsonValue )
Set key to specific value.
If key is already a member of json object, its value is overwritten. Otherwise, the key:value pair is appended to the json object.
Method SetBool : Void ( key:String, value:Bool )
Set key to boolean value.
If key is already a member of json object, its value is overwritten. Otherwise, the key:value pair is appended to the json object.
Method SetFloat : Void ( key:String, value:Float )
Set key to float value.
If key is already a member of json object, its value is overwritten. Otherwise, the key:value pair is appended to the json object.
Method SetInt : Void ( key:String, value:Int )
Set key to integer value.
If key is already a member of json object, its value is overwritten. Otherwise, the key:value pair is appended to the json object.
Method SetString : Void ( key:String, value:String )
Set key to string value.
If key is already a member of json object, its value is overwritten. Otherwise, the key:value pair is appended to the json object.