Skip to content

AlexYukikaze/JSONx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSONx

Gitter

JSONx grammar

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

Multi-file JSON load

####example.jsonx

{
  "greetings": ${ "greetings_file.jsonx": "." }
}

####greetings_file.jsonx

"Hello JSONx"
import JSONxLoader
result = JSONxLoader.load("example.jsonx")
>>> { "greetings" : "Hello JSONx" }

Parse string

import JSONx
json_string = """
{
    "name": "Alexander",
    "nickname": "Yukikaze",
    "etc": ["list", "of", "anything", 1, 2, 3.14, true, false, null]
}
"""
result = JSONx.parse(json_string)

About

Extended JSON parser for XVM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published