Skip to main content

toJSON (Function)

Function converts a map into a JSON object and returns the JSON as a string.

Syntax

<STRING> map:toJSON(<OBJECT> map)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
mapThe map that needs to be converted to JSONOBJECTNoYes

Example 1

map:toJSON(company)

If company is a map with key-value pairs, (symbol:gdn),(volume : 100), and (price, 200), it returns the JSON string {"symbol" : "gdn", "volume" : 100 , "price" : 200}.