-
Notifications
You must be signed in to change notification settings - Fork 1
FromJson
ricardoboss edited this page Sep 13, 2023
·
1 revision
fromJson
is a function that converts a JSON string to a STEP-type.
fromJson(string json)
-
json
must be a string containing valid JSON.
- any type (
number
,string
,bool
,null
,list
,map
) can be returned - if the JSON string is invalid,
null
is returned - if the JSON string is empty,
null
is returned - a JSON object is converted to a STEP map (order is not guaranteed to be preserved)
- a JSON array is converted to a STEP list (order is preserved)
- the
fromJson
function is the inverse of thetoJson
function
fromJson("{\"a\": 1, \"b\": 2}") // returns a map: {"a": 1, "b": 2}
fromJson("[1, 2, 3]") // returns a list: [1, 2, 3]
fromJson("{\"a\": 1, \"b\": 2") // returns null
© 2023 Ricardo Boss • Licensed under MIT • Want to update this page? Edit it on GitHub and submit a pull request!