Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

JSON.ENCODE

Kirill Chernyshov edited this page Mar 13, 2019 · 1 revision

The JSON.ENCODE Function

Function Group: Json

JSON.ENCODE encodes a context reference into JSON.

Syntax

JSON.ENCODE(arg1)

  • arg1 is a string

Uses

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]}'.

Notes

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

Clone this wiki locally