Difference between revisions of "Json"
Jump to navigation
Jump to search
(Created page with "In Mini Micro, <c>json</c> is an import module in the <c>/sys/lib</c> directory. It provides conversion of MiniScript values to and from JSON format, as well as some...") |
|||
| Line 1: | Line 1: | ||
In [[Mini Micro]], <c>json</c> is an [[import]] module in the <c>/sys/lib</c> directory. It provides conversion of MiniScript values to and from JSON format, as well as some related utility functions. | In [[Mini Micro]], <c>json</c> is an [[import]] module in the <c>/sys/lib</c> directory. It provides conversion of MiniScript values to and from JSON format, as well as some related utility functions. | ||
| − | { | + | In [[Mini Micro]], <c>stringUtil</c> is an [[import]] module in the <c>/sys/lib</c> directory. It provides various additional [[string]]-related functions, directly extending the [[string]] datatype. |
| + | |||
| + | Like all the modules in <c>/sys/lib</c>, the best documentation for stringUtil is the source code (<c>/sys/lib/stringUtil.ms</c>) itself. But this page summarizes the content in more concise form. | ||
| + | |||
| + | == Functions == | ||
| + | |||
| + | After [[import|importing]] "json", the following methods may be accessed under the <c>json</c> map (e.g. as <c>json.parse</c>). | ||
| + | |||
| + | {| class="wikitable" | ||
| + | |- | ||
| + | ! Method !! Purpose | ||
| + | |- | ||
| + | | parse(''jsonString'') || parses JSON data into native MiniScript values | ||
| + | |- | ||
| + | | toJSON(''value'', ''compact''=false, ''indent''=0) || converts MiniScript values into JSON format | ||
| + | |- | ||
| + | | escape(''s'') || change special characters into backslash sequences | ||
| + | |- | ||
| + | | unescape(''s'') || replace backslash sequences with normal characters | ||
| + | |} | ||
[[Category:Mini Micro]] | [[Category:Mini Micro]] | ||
Revision as of 17:29, 12 September 2021
In Mini Micro, json is an import module in the /sys/lib directory. It provides conversion of MiniScript values to and from JSON format, as well as some related utility functions.
In Mini Micro, stringUtil is an import module in the /sys/lib directory. It provides various additional string-related functions, directly extending the string datatype.
Like all the modules in /sys/lib, the best documentation for stringUtil is the source code (/sys/lib/stringUtil.ms) itself. But this page summarizes the content in more concise form.
Functions
After importing "json", the following methods may be accessed under the json map (e.g. as json.parse).
| Method | Purpose |
|---|---|
| parse(jsonString) | parses JSON data into native MiniScript values |
| toJSON(value, compact=false, indent=0) | converts MiniScript values into JSON format |
| escape(s) | change special characters into backslash sequences |
| unescape(s) | replace backslash sequences with normal characters |