JSONx -> value eof
value -> object | array | reference | string | number
object -> '{' pairs '}' | '{' '}'
pairs -> pair (',' pair)*
pair -> string ':' value
array -> '[' elements ']' | '[' ']'
elements -> value (',' value)*
reference -> '$' '{' string (':' string)? '}'
string -> ("(?:[^"\\]|\\.)*")
number -> ([+-]?(0|[1-9][0-9]*)(\.[0-9]*)?([eE][+-]?[0-9]+)?)
eof -> !.
####example.jsonx
{
"greetings": ${ "greetings_file.jsonx": "." }
}
####greetings_file.jsonx
"Hello JSONx"
import JSONxLoader
result = JSONxLoader.load("example.jsonx")
>>> { "greetings" : "Hello JSONx" }
import JSONx
json_string = """
{
"name": "Alexander",
"nickname": "Yukikaze",
"etc": ["list", "of", "anything", 1, 2, 3.14, true, false, null]
}
"""
result = JSONx.parse(json_string)