JSONLang is a programming language written in JSON format.
Using Python Implement:
$ cd python
$ python jsonlang.py
>> exit
Type exit
to quit.
Or
$ pip install jsonlang
You can write DSL code in $dsl
field in JSON object, and then run
from jsonlang import exec_jsonlang
# Given your json object
dsl = load_dsl_from_database()
your_json_object = exec_jsonlang(dsl, your_json_object)
>> {"$if": true, "$then": 1, "$else": 2 }
1
>> {"$empty": 0 }
True
>> {"$empty": 1 }
False
>> {"$ref": "A"}
undefined
>> {"$assign": "A", "$to": 1}
1
>> {"$ref": "A"}
1
>> {"$empty": {"$ref": ""A}}
False
>> {"$eq": "A", "$to": 1}
True
>> {"$if": {"$eq": "A", "$to": 1}, "$then": {"$assign": "A", "$to": 2}}
2
>> {"$eq": "A", "$to": 2}
True
>> {"$not": {"$empty": "A"}}
True
>> {"$deref": "A"}
None
>> {"$ref": "A"}
undefined
>> {"$local": "$$A", "$to": 1}
1
>> {"$ref": "$$A"}
1