# jsonexpr for Python
This document describes using jsonexpr with Python.
For the language overview, see the [main page](https://github.com/markuskimius/jsonexpr).
## Installation
```sh
pip3 install jsonexpr
```
Python 3.8 and later are supported.
## Example
```python
import jsonexpr
compiled = jsonexpr.compile("""
PRINT("I have " + LEN(grades) + " students");
PRINT("Alice's grade is " + grades.alice);
""")
compiled.setSymbols({
"grades" : {
"alice" : "A",
"bob" : "B",
}
});
result = compiled.eval()
```
Output:
```
I have 2 students
Alice's grade is A
```
## License
[Apache 2.0](https://github.com/markuskimius/jsonexpr/blob/main/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/markuskimius/jsonexpr",
"name": "jsonexpr",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "expression, language, json",
"author": "Mark Kim",
"author_email": "markuskimius+py@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fc/0f/97f76b068c31f4be3e1517e0d87a72a68963e73d36f4fb037bfe34898dce/jsonexpr-0.0.25.tar.gz",
"platform": null,
"description": "# jsonexpr for Python\n\nThis document describes using jsonexpr with Python.\nFor the language overview, see the [main page](https://github.com/markuskimius/jsonexpr).\n\n\n## Installation\n\n```sh\npip3 install jsonexpr\n```\n\nPython 3.8 and later are supported.\n\n\n## Example\n\n```python\nimport jsonexpr\n\ncompiled = jsonexpr.compile(\"\"\"\n PRINT(\"I have \" + LEN(grades) + \" students\");\n PRINT(\"Alice's grade is \" + grades.alice);\n\"\"\")\n\ncompiled.setSymbols({\n \"grades\" : {\n \"alice\" : \"A\",\n \"bob\" : \"B\",\n }\n});\n\nresult = compiled.eval()\n```\n\nOutput:\n\n```\nI have 2 students\nAlice's grade is A\n```\n\n\n## License\n\n[Apache 2.0](https://github.com/markuskimius/jsonexpr/blob/main/LICENSE)\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "An expression language.",
"version": "0.0.25",
"project_urls": {
"Homepage": "https://github.com/markuskimius/jsonexpr"
},
"split_keywords": [
"expression",
" language",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fc0f97f76b068c31f4be3e1517e0d87a72a68963e73d36f4fb037bfe34898dce",
"md5": "0ef877f14804abe369a55d1d3bfc025b",
"sha256": "5f38cb461539be04fe77ed0d7409fe80584cb75ce66a9a29ae5b9e19135ab8d7"
},
"downloads": -1,
"filename": "jsonexpr-0.0.25.tar.gz",
"has_sig": false,
"md5_digest": "0ef877f14804abe369a55d1d3bfc025b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 124379,
"upload_time": "2024-11-18T04:32:52",
"upload_time_iso_8601": "2024-11-18T04:32:52.528910Z",
"url": "https://files.pythonhosted.org/packages/fc/0f/97f76b068c31f4be3e1517e0d87a72a68963e73d36f4fb037bfe34898dce/jsonexpr-0.0.25.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 04:32:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "markuskimius",
"github_project": "jsonexpr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonexpr"
}