Monkey Documentation

Class JsonObject


Extends:
Constructors:
  • New ()
  • New ( json:String )
  • New ( data:StringMap<JsonValue> )
Methods:
  • Contains : Bool ( key:String )
  • Get : JsonValue ( key:String, defval:JsonValue=null )
  • GetBool : Int ( key:String, defval:Bool=false )
  • GetData : StringMap<JsonValue> ()
  • GetFloat : Float ( key:String, defval:Float=0 )
  • GetInt : Int ( key:String, defval:Int=0 )
  • GetString : String ( key:String, defval:String="" )
  • PushJson : Void ( buf:StringStack )
  • Set : Void ( key:String, value:JsonValue )
  • SetBool : Void ( key:String, value:Bool )
  • SetFloat : Void ( key:String, value:Float )
  • SetInt : Void ( key:String, value:Int )
  • SetString : Void ( key:String, value:String )
Inherited Methods:

Constructor Documentation

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 Documentation

Method Contains : Bool ( key:String )

Returns true if the json object contains key.

Method Get : JsonValue ( key:String, defval:JsonValue=null )

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 )

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.

Method GetFloat : Float ( key:String, defval:Float=0 )

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 )

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="" )

Returns defval if key doesn't exist.

Throws a JsonError if value mapped to key is not a JsonString.

Method PushJson : Void ( buf:StringStack )

Method Set : Void ( key:String, value:JsonValue )

Method SetBool : Void ( key:String, value:Bool )

Method SetFloat : Void ( key:String, value:Float )

Method SetInt : Void ( key:String, value:Int )

Method SetString : Void ( key:String, value:String )