This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
JSON.ENCODE
Kirill Chernyshov edited this page Mar 13, 2019
·
1 revision
JSON.ENCODE
encodes a context reference into JSON.
JSON.ENCODE(arg1)
-
arg1
is a string
Let's say we receive some vehicle information like that shown below:
{
"data":{
"vehicle":{ "model": "prototype", "serial_numbers": [1, 2, 3] }
}
}
If we want to pass along that vehicle information as a JSON string, we can use JSON.ENCODE
:
JSON.ENCODE(data.vehicle)
This will return '{"model": "prototype", "serial numbers": [1,2,3]}'
.
This function can only take a context reference (i.e. data.vehicle
), which means that passing map literals directly into the function won't work.
To perform the opposite operation, decoding a given JSON, use JSON.DECODE