Functions of ballerina.lang.jsons package
function getKeys(json j) (string[] )
Returns an array of keys contained in the specified JSON.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
j | json | A JSON object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string[] | string[]: A string array of keys contained in the specified JSON |
function parse(string jsonStr) (json )
Parses the string argument as a JSON value.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
jsonStr | string | String representation of JSON |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
json | json: Parsed JSON value |
function remove(json j, string key)
Removes each element that matches the given key.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
j | json | A JSON object |
key | string | Key of the field to remove |
function toString(json j) (string )
Converts a JSON object to a string representation
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
j | json | A JSON object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | string: String value of the converted JSON |
function toXML(json j, Options options) (xml )
Converts a JSON object to a XML representation
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
j | json | A JSON object |
options | Options | j: A JSON object |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
xml | xml: XML value of the converted JSON |
Structs of ballerina.lang.jsons package
struct Options
Fields:
Field Name | Data Type | Description |
---|---|---|
attributePrefix | string | |
arrayEntryTag | string |