json
Contains functions for working with the json format
Functions
jsondecode(data)
— converts data to json string
use json
print jsondecode("{\"key1\":1,\"key2\":[1,2,3],\"key3\":\"text\"}") // {key2=[1, 2, 3], key3=text, key1=1}
jsonencode(jsonString, indent = 0)
— converts string to data
use json
data = {
"key1": 1,
"key2": [1, 2, 3],
"key3": "text"
}
print jsonencode(data) // {"key1":1,"key2":[1,2,3],"key3":"text"}