Json
Functions
Create Json
Create Json
The empty Json
object returned can be filled with data and read by the functions and procedures prefixed with json_add_
and json_read_
Return Type: Json
Signatures:
Create Json
string json_string
must be valid JSON. The Json
object returned can be filled with data and read by the functions and procedures prefixed with json_add_
and json_read_
Parameters:
Name | Type | Description |
---|---|---|
json_string | String | The JSON formatted String to be converted to a Json object. |
Return Type: Json
Signatures:
Free All Json
Releases all of the Json
objects which have been loaded.
Signatures:
Free Json
Frees the SplashKit resources associated with the Json
object.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object whose resources should be released. |
Signatures:
Json Count Keys
Returns the count of keys in the top-level Json
object.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object to count keys. |
Return Type: Integer
Signatures:
Json From Color
Converts a Color
to a Json
object.
Parameters:
Name | Type | Description |
---|---|---|
clr | Color | The Color to convert to Json . |
Return Type: Json
Signatures:
Json From File
Reads a Json
object from a JSON string stored in Resources/json/filename
and loads the data into the returned Json
object.
Parameters:
Name | Type | Description |
---|---|---|
filename | String | The filename of the file to be written to Resources/json/ . |
Return Type: Json
Signatures:
Json From String
Reads a Json
object from a String
in the JSON format.
Parameters:
Name | Type | Description |
---|---|---|
j_string | String | A String in the JSON format. |
Return Type: Json
Signatures:
Json Has Key
Checks if the Json
object contains the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object to check for the given key. |
key | String | The String key to be checked. |
Return Type: Boolean
Signatures:
Json Read Array
Json Read Array
Reads an array of Double
values from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
out_result | Vector | The array which will be filled with the data stored for String key. |
Signatures:
Json Read Array
Reads an array of Json
object values from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
out_result | Vector | The array which will be filled with the data stored for String key. |
Signatures:
Json Read Array
Reads an array of String
values from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
out_result | Vector | The array which will be filled with the data stored for String key. |
Signatures:
Json Read Array
Reads an array of Boolean
values from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
out_result | Vector | The array which will be filled with the data stored for String key. |
Signatures:
Json Read Bool
Reads a Boolean
value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: Boolean
Signatures:
Json Read Number
Reads a Float
value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: Float
Signatures:
Json Read Number As Double
Reads a Double
value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: Double
Signatures:
Json Read Number As Int
Reads a integer
value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: Integer
Signatures:
Json Read Object
Reads a Json
object value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: Json
Signatures:
Json Read String
Reads a String
value from the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object from which data will be returned for the given key. |
key | String | The String key used to find data in the Json object. |
Return Type: String
Signatures:
Json Set Array
Json Set Array
Adds an array of String
values to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Vector | The value to be inserted into the Json object. |
Signatures:
Json Set Array
Adds an array of Double
values to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Vector | The value to be inserted into the Json object. |
Signatures:
Json Set Array
Adds an array of Boolean
values to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Vector | The value to be inserted into the Json object. |
Signatures:
Json Set Array
Adds an array of Json
object values to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Vector | The value to be inserted into the Json object. |
Signatures:
Json Set Bool
Adds a Boolean
value to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Boolean | The value to be inserted into the Json object. |
Signatures:
Json Set Number
Json Set Number
Adds an Integer
value to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Integer | The value to be inserted into the Json object. |
Signatures:
Json Set Number
Adds a Double
value to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Double | The value to be inserted into the Json object. |
Signatures:
Json Set Number
Adds a Float
value to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | Float | The value to be inserted into the Json object. |
Signatures:
Json Set Object
Adds a Json
object to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
obj | Json | The value to be inserted into the Json object. |
Signatures:
Json Set String
Adds a String
value to the Json
object for the given String
key.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object where data will be inserted for the given key. |
key | String | The String key where data will be stored in the Json object. |
value | String | The value to be inserted into the Json object. |
Signatures:
Json To Color
Converts a Json
object to a Color
object.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json to convert to a Color . |
Return Type: Color
Signatures:
Json To File
Writes the Json
object to a JSON string stored in Resources/json/filename
.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object to be written to file. |
filename | String | The filename of the file to be stored in Resources/json/ |
Signatures:
Json To String
Converts and returns the Json
object as a String
.
Parameters:
Name | Type | Description |
---|---|---|
j | Json | The Json object to be converted to a String . |
Return Type: String
Signatures:
Types
Json
The Json
type is used to refer to objects in the JSON format that can be
manipulated by the SplashKit Json
functions and procedures.
All Json
objects are:
-
created with
create_json()
orcreate_json(string s)
orjson_from_string(string s)
orjson_from_file(json j)
-
and must be released using
free_json()
(to release a specificJson
object) orfree_all_json()
(to release all loadedJson
objects).