Convert an array into a JSON string

json:encode(data) : STRING

json:encode(2.398)
#=> "2.398"

json:encode(FALSE)
#=> "false"

json:encode(["user"=>"name",'case-numbers' => [1,2,3]])
#=> "{\n    \"user\": \"name\",\n    \"case-numbers\": [\n        1,\n        2,\n        3\n    ]\n}"


# if number is too big, you should transform into string or otherwise JS cannot handle very large numbers
json:encode(type:to_string(98658540238933927))
#=> "\"98658540238933927\""

Copyright ©2013-2022 SunSed®. All rights reserved.