-
Notifications
You must be signed in to change notification settings - Fork 1
ToJson
ricardoboss edited this page Sep 13, 2023
·
1 revision
The toJson
function converts a STEP value to a JSON string.
toJson(any value)
-
value
can be any STEP value (number
,string
,bool
,list
,map
,null
).
- the
toJson
function is the inverse of thefromJson
function - the returned value is always a string
toJson(1) // returns "1"
toJson("hello") // returns "\"hello\""
toJson(true) // returns "true"
toJson(null) // returns "null"
toJson([1, 2, 3]) // returns "[1, 2, 3]"
toJson({"a": 1, "b": 2}) // returns "{\"a\": 1, \"b\": 2}"
© 2023 Ricardo Boss • Licensed under MIT • Want to update this page? Edit it on GitHub and submit a pull request!