# 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/4f/f8/e595fbdf7b94355c07677f6e2428b3eee6d33fbd4d9f8a06341ea5c7295b/jsonexpr-0.0.26.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.26",
"project_urls": {
"Homepage": "https://github.com/markuskimius/jsonexpr"
},
"split_keywords": [
"expression",
" language",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ff8e595fbdf7b94355c07677f6e2428b3eee6d33fbd4d9f8a06341ea5c7295b",
"md5": "1718e93235c5258954d58687b79142be",
"sha256": "97e95c5dc37c0f3725881e74ceb30e0a8e4899854d8a9d62c4a5c5101a9e6c01"
},
"downloads": -1,
"filename": "jsonexpr-0.0.26.tar.gz",
"has_sig": false,
"md5_digest": "1718e93235c5258954d58687b79142be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 129988,
"upload_time": "2024-12-12T05:01:28",
"upload_time_iso_8601": "2024-12-12T05:01:28.076690Z",
"url": "https://files.pythonhosted.org/packages/4f/f8/e595fbdf7b94355c07677f6e2428b3eee6d33fbd4d9f8a06341ea5c7295b/jsonexpr-0.0.26.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 05:01:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "markuskimius",
"github_project": "jsonexpr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jsonexpr"
}