Skip to content
ricardoboss edited this page Sep 13, 2023 · 1 revision

Description

The toJson function converts a STEP value to a JSON string.

Syntax

toJson(any value)
  • value can be any STEP value (number, string, bool, list, map, null).

Remarks

  • the toJson function is the inverse of the fromJson function
  • the returned value is always a string

Examples

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}"