JSON Feature Set
M7 Script extends standard JSON parsing with additional features:
Parse JSON and return structure:
php main.php --file=jsonTest/nested.json --verbose --to=eval --lang=json
Supported Features
- String Formats:
- Double-quoted (
"text") - Single-quoted (
'text') - Backticked (
`text`for string interpolation)
- Double-quoted (
- Trailing Commas: Allows JSON objects and arrays to have trailing commas.
- Comments:
- Single-line comments using
// - Multi-line comments using
/* */
- Single-line comments using
- Naked Keys: Keys can be written without quotes (e.g.,
{ key: "value" }). - Additional Data Formats:
- Hexadecimal (
0x...) - Binary (
0b...) - Octal (
0o...)
- Hexadecimal (
- Case Insensitivity: Hex, binary, and octal prefixes are case insensitive (
0X...,0B...,0O...are valid).
Upcoming Features
- Pragmas: Allows startup options to be specified within JSON files.
- String Interpolation: Enables dynamic content within string values.
- Inline Code Blocks: Supports embedding executable code within JSON.
- Include Directive (
include(...)): Enables referencing other files and sections of JSON for modular configurations. - SQL Directive (
sql(...)): Allows dynamic data retrieval via SQL queries. - Custom Commands: Supports executing custom commands passed via the
evalphase of the interpreter.
More features may be added as the JSON support is expanded.