# 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/49/49/92060aae0d2178c81219c9597593ca021dccd76b4c41bfc420495b335a7f/jsonexpr-0.1.0.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.1.0",
"project_urls": {
"Homepage": "https://github.com/markuskimius/jsonexpr"
},
"split_keywords": [
"expression",
" language",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "494992060aae0d2178c81219c9597593ca021dccd76b4c41bfc420495b335a7f",
"md5": "f14b385ffbc5c331553bef7233cdf99a",
"sha256": "52c5a791dc4daef135e6c10664e989ce530aa477e157f224eea7f076429b1205"
},
"downloads": -1,
"filename": "jsonexpr-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f14b385ffbc5c331553bef7233cdf99a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 169095,
"upload_time": "2025-02-11T03:32:47",
"upload_time_iso_8601": "2025-02-11T03:32:47.039566Z",
"url": "https://files.pythonhosted.org/packages/49/49/92060aae0d2178c81219c9597593ca021dccd76b4c41bfc420495b335a7f/jsonexpr-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 03:32:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "markuskimius",
"github_project": "jsonexpr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonexpr"
}