{"id":15437956,"url":"https://github.com/rayokota/jsonata-python","last_synced_at":"2025-04-06T12:07:22.473Z","repository":{"id":243304691,"uuid":"802946815","full_name":"rayokota/jsonata-python","owner":"rayokota","description":"JSONata for Python","archived":false,"fork":false,"pushed_at":"2025-03-16T06:21:24.000Z","size":348,"stargazers_count":39,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T11:06:19.736Z","etag":null,"topics":["json","jsonata","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rayokota.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-19T17:23:46.000Z","updated_at":"2025-03-19T12:30:40.000Z","dependencies_parsed_at":"2025-01-15T20:24:12.486Z","dependency_job_id":"c90fa958-9973-4496-ba8e-d8c228dbe517","html_url":"https://github.com/rayokota/jsonata-python","commit_stats":{"total_commits":64,"total_committers":4,"mean_commits":16.0,"dds":0.109375,"last_synced_commit":"3baa4833bc6eb737df3ed9784f492e8273ee3534"},"previous_names":["rayokota/jsonata-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayokota%2Fjsonata-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayokota%2Fjsonata-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayokota%2Fjsonata-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rayokota%2Fjsonata-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rayokota","download_url":"https://codeload.github.com/rayokota/jsonata-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478318,"owners_count":20945266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","jsonata","python3"],"created_at":"2024-10-01T18:59:55.976Z","updated_at":"2025-04-06T12:07:22.450Z","avatar_url":"https://github.com/rayokota.png","language":"Python","readme":"# jsonata-python\n\n[![Build Status][github-actions-shield]][github-actions-link]\n[![PyPI](https://img.shields.io/pypi/v/jsonata-python.svg)](https://www.pypi.org/project/jsonata-python)\n\n[github-actions-shield]: https://github.com/rayokota/jsonata-python/actions/workflows/test.yml/badge.svg?branch=master\n[github-actions-link]: https://github.com/rayokota/jsonata-python/actions\n\nPure Python implementation of JSONata.\n\nThis is a Python port of the  [JSONata reference implementation](https://github.com/jsonata-js/jsonata), \nand also borrows from the [Dashjoin Java port](https://github.com/dashjoin/jsonata-java).\n\nThis implementation supports 100% of the language features of JSONata, with no external dependencies.\nThe JSONata documentation can be found [here](https://jsonata.org).\n\n\n## Installation\n\n```\npip install jsonata-python\n```\n\n## Getting Started\n\nA very simple start:\n\n```\n\u003e\u003e\u003e import jsonata\n\u003e\u003e\u003e data = {\"example\": [{\"value\": 4}, {\"value\": 7}, {\"value\": 13}]}\n\u003e\u003e\u003e expr = jsonata.Jsonata(\"$sum(example.value)\")\n\u003e\u003e\u003e result = expr.evaluate(data)\n\u003e\u003e\u003e result\n24\n```\n\n## Command Line Interface\n\nThe CLI provides the same functionality as the [Dashjoin JSONata CLI](https://github.com/dashjoin/jsonata-cli).\n\n```\n% python3 -m jsonata.cli\nusage: jsonata.cli [-h] [-v] [-e \u003cfile\u003e] [-i \u003carg\u003e] [-ic \u003carg\u003e] [-f {auto,json,string}] [-o \u003carg\u003e] [-oc \u003carg\u003e] [-time] [-c] [-b \u003cjson-string\u003e]\n                   [-bf \u003cfile\u003e] [-it]\n                   [expr]\n\nPure Python JSONata CLI\n\npositional arguments:\n  expr\n\noptions:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  -e \u003cfile\u003e, --expression \u003cfile\u003e\n                        JSON expression to evaluate.\n  -i \u003carg\u003e, --input \u003carg\u003e\n                        JSON input file (- for stdin)\n  -ic \u003carg\u003e, --icharset \u003carg\u003e\n                        Input character set (default=utf-8)\n  -f {auto,json,string}, --format {auto,json,string}\n                        Input format (default=auto)\n  -o \u003carg\u003e, --output \u003carg\u003e\n                        JSON output file (default=stdout)\n  -oc \u003carg\u003e, --ocharset \u003carg\u003e\n                        Output character set (default=utf-8)\n  -time                 Print performance timers to stderr\n  -c, --compact         Compact JSON output (don't prettify)\n  -b \u003cjson-string\u003e, --bindings \u003cjson-string\u003e\n                        JSONata variable bindings\n  -bf \u003cfile\u003e, --bindings-file \u003cfile\u003e\n                        JSONata variable bindings file\n  -it, --interactive    Interactive REPL (requires input file)\n```\n\n### Examples\n\n```\n% echo '{\"a\":\"hello\", \"b\":\" world\"}' | python3 -m jsonata.cli '(a \u0026 b)'\nhello world\n\n% echo '{\"a\":\"hello\", \"b\":\" world\"}' | python3 -m jsonata.cli -o helloworld.json $\n# helloworld.json written\n\n% ls | python3 -m jsonata.cli $\nhelloworld.json\n\n% ps -o pid=\"\",%cpu=\"\",%mem=\"\" | python3 -m jsonata.cli '$.$split(/\\n/).$trim().[ $split(/\\s+/)[$length()\u003e0].$number() ]' -c\n[[4105,0,0],[4646,0,0],[4666,0,0],[33696,0,0]...]\n\n% curl -s https://raw.githubusercontent.com/jsonata-js/jsonata/master/test/test-suite/datasets/dataset1.json | python3 -m jsonata.cli '{\"Name\": FirstName \u0026 \" \" \u0026 Surname, \"Cities\": **.City, \"Emails\": Email[type=\"home\"].address}'\n{\n  \"Name\": \"Fred Smith\",\n  \"Cities\": [\n    \"Winchester\",\n    \"London\"\n  ],\n  \"Emails\": [\n    \"freddy@my-social.com\",\n    \"frederic.smith@very-serious.com\"\n  ]\n}\n\n% python3 -m jsonata.cli -i helloworld.json -it\nEnter an expression to have it evaluated.\nJSONata\u003e (a \u0026 b)\nhello world\n```\n\n## Running Tests\n\nThis project uses the repository of the reference implementation as a submodule. This allows referencing the current version of the unit tests. To clone this repository, run:\n\n```\ngit clone --recurse-submodules https://github.com/rayokota/jsonata-python\n```\n\nTo build and run the unit tests:\n\n```\npython3 -m pip install nox\nnox --sessions tests\n```\n\n## Notes\n\nJSONata date/time functions that use ISO 8601 formats are only supported with Python 3.11+.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayokota%2Fjsonata-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayokota%2Fjsonata-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayokota%2Fjsonata-python/lists"}