# 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/58/e5/6f0fe172126621c82c5e82305b46ac77c1aeb408c584f98c5fa5267ed014/jsonexpr-0.0.24.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.24",
"project_urls": {
"Homepage": "https://github.com/markuskimius/jsonexpr"
},
"split_keywords": [
"expression",
" language",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58e56f0fe172126621c82c5e82305b46ac77c1aeb408c584f98c5fa5267ed014",
"md5": "9154376e957d692563883addbeaca979",
"sha256": "c8989f6bfe5783be064dd9eb400e0bc7ad8a87aa2be79fdd6efa6690a47619b1"
},
"downloads": -1,
"filename": "jsonexpr-0.0.24.tar.gz",
"has_sig": false,
"md5_digest": "9154376e957d692563883addbeaca979",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 124028,
"upload_time": "2024-11-17T02:07:51",
"upload_time_iso_8601": "2024-11-17T02:07:51.248622Z",
"url": "https://files.pythonhosted.org/packages/58/e5/6f0fe172126621c82c5e82305b46ac77c1aeb408c584f98c5fa5267ed014/jsonexpr-0.0.24.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 02:07:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "markuskimius",
"github_project": "jsonexpr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonexpr"
}