Difference between revisions of "Grfon"

From MiniScript Wiki
Jump to navigation Jump to search
(Initial Page)
 
m
 
Line 31: Line 31:
 
s = toGRFON([1, 2, "foo"], true)
 
s = toGRFON([1, 2, "foo"], true)
 
</ms>
 
</ms>
 +
 +
[[Category:Sys Modules]]
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
[[Category:Sys Modules]]
+
[[Category:Command-Line_MiniScript]]

Latest revision as of 01:12, 5 April 2025

GRFON is a simpler and gentler file format compared to JSON and was designed to be especially human-editable. For information on the GRFON file specification, see: https://github.com/JoeStrout/grfon/blob/main/docs/README.md

Functions

Name Description
parse(string) convert a GRFON string into a MiniScript value (which could include a list or map of other values). This is the main entry point for reading GRFON data and converting it to native form.
escape(string) Escape any special characters in the given string by preceding them with backslashes.
unescape(string) Replaces backslash sequences in the given string with the appropriate character.
toGRFON((value, compact=false, indent=0, topLevel=true) Converts a value to GRFON syntax.


Properties

Name Description
interpretTrueAndFalse Flag to control whether strings "true" and "false" should be returned as 1 or 0, or left as strings.
interpretNull Similar flag for string "null".

Examples

s = toGRFON([1, 2, "foo"], true)