{"id":13813680,"url":"https://github.com/johnnoone/json-spec","last_synced_at":"2026-02-22T11:08:44.499Z","repository":{"id":17606193,"uuid":"20410039","full_name":"johnnoone/json-spec","owner":"johnnoone","description":"Implements some tools for JSON","archived":false,"fork":false,"pushed_at":"2024-06-12T08:38:46.000Z","size":359,"stargazers_count":38,"open_issues_count":14,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-14T10:32:41.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnnoone.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":"CONTRIBUTING.rst","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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-02T15:59:44.000Z","updated_at":"2024-09-12T08:23:52.000Z","dependencies_parsed_at":"2024-06-18T22:42:16.699Z","dependency_job_id":"64faba1f-7894-4892-a06e-e0a4167a7e7d","html_url":"https://github.com/johnnoone/json-spec","commit_stats":{"total_commits":129,"total_committers":10,"mean_commits":12.9,"dds":"0.33333333333333337","last_synced_commit":"81520a7819d1047f7ed84a8b5a7931b0c05e1c24"},"previous_names":["johnnoone/json-extensions"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/johnnoone/json-spec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnoone%2Fjson-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnoone%2Fjson-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnoone%2Fjson-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnoone%2Fjson-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnnoone","download_url":"https://codeload.github.com/johnnoone/json-spec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnnoone%2Fjson-spec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29710317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T10:34:24.778Z","status":"ssl_error","status_checked_at":"2026-02-22T10:32:23.200Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-08-04T04:01:25.615Z","updated_at":"2026-02-22T11:08:44.484Z","avatar_url":"https://github.com/johnnoone.png","language":"Python","readme":"Json Spec\n=========\n\n.. image:: https://badge.fury.io/py/json-spec.png\n    :target: http://badge.fury.io/py/json-spec\n\n.. image:: https://travis-ci.org/johnnoone/json-spec.png?branch=master\n    :target: https://travis-ci.org/johnnoone/json-spec\n\nThis library implements several JSON specs, like `JSON Schema`_,\n`JSON Reference`_ and `JSON Pointer`_:\n\n* It works on python 3.6 and above\n* It is release under the `BSD license`_\n\n\nInstallation\n------------\n\nThis library has only weak dependencies. You can simply use pip::\n\n    $ pip install json-spec\n\nRegading you needs, you can install more features. For example, this command\nwill enable colorated messages::\n\n    $ pip install json-spec[cli]\n\nThis one will enable ip format for json schema::\n\n    $ pip install json-spec[ip]\n\n...\n\n\nCLI Usage\n---------\n\nThis module expose a cli command with multiple operations.\n\n**json add** will transform the json document::\n\n    $ json add '#/foo/1' --fragment-file=fragment.json --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json add '#/foo/1' --fragment-json='first'\n    $ json add '#/foo/1' --fragment-file=fragment.json --document-file=doc.json\n    $ json add '#/foo/1' --fragment-file=fragment.json \u003c doc.json\n\n**json check** will test that a value at the target location is equal to a specified value::\n\n    $ json check '#/foo/1' --fragment-file=fragment.json --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json check '#/foo/1' --fragment-file=fragment.json\n    $ json check '#/foo/1' --fragment-file=fragment.json --document-file=doc.json\n    $ json check '#/foo/1' --fragment-file=fragment.json \u003c doc.json\n\n**json copy** will copy the value at a specified location to the target location::\n\n    $ json copy '#/foo/1' --target='#/foo/2' --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json copy '#/foo/1' --target='#/foo/2'\n    $ json copy '#/foo/1' --target='#/foo/2' --document-file=doc.json\n    $ json copy '#/foo/1' --target='#/foo/2' \u003c doc.json\n\n**json extract** will extract parts of your json document::\n\n    $ json extract '#/foo/1' --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json extract '#/foo/1'\n    $ json extract '#/foo/1' --document-file=doc.json\n    $ json extract '#/foo/1' \u003c doc.json\n\n**json move** will remove the value at a specified location and it will add the value to the target location::\n\n    $ json move '#/foo/2' --target='#/foo/1' --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json move '#/foo/2' --target='#/foo/1'\n    $ json move '#/foo/2' --target='#/foo/1' --document-file=doc.json\n    $ json move '#/foo/2' --target='#/foo/1' \u003c doc.json\n\n**json remove** will remove the value at a specified location::\n\n    $ json remove '#/foo/1' --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json remove '#/foo/1'\n    $ json remove '#/foo/1' --document-file=doc.json\n    $ json remove '#/foo/1' \u003c doc.json\n\n**json replace** will replace the value at a specified location with given fragment::\n\n    $ json replace '#/foo/1' --fragment-file=fragment.json --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json replace '#/foo/1' --fragment-file=fragment.json\n    $ json replace '#/foo/1' --fragment-file=fragment.json --document-file=doc.json\n    $ json replace '#/foo/1' --fragment-file=fragment.json \u003c doc.json\n\n**json validate** will validate your document against a schema::\n\n    $ json validate --schema-file=schema.json --document-json='{\"foo\": [\"bar\", \"baz\"]}'\n    $ echo '{\"foo\": [\"bar\", \"baz\"]}' | json validate --schema-file=schema.json\n    $ json validate --schema-file=schema.json --document-file=doc.json\n    $ json validate --schema-file=schema.json \u003c doc.json\n\n\nLibrary usage\n-------------\n\nLet say you want to fetch / validate JSON like objects in you python scripts.\n\nYou can extract member of an object with `JSON Pointer`_::\n\n    from jsonspec.pointer import extract\n\n    obj = {\n        'foo': ['bar', 'baz', 'quux']\n    }\n    assert 'baz' == extract(obj, '/foo/1')\n\n\nYou can resolve member of any object with `JSON Reference`_::\n\n    from jsonspec.reference import resolve\n\n    obj = {\n        'foo': ['bar', 'baz', {\n            '$ref': '#/sub'\n        }],\n        'sub': 'quux'\n    }\n\n    assert 'quux' == resolve(obj, '#/foo/2')\n\n\nYou can describe you data with `JSON Schema`_::\n\n    from jsonspec.validators import load\n\n    # data will validate against this schema\n    validator = load({\n        'title': 'Example Schema',\n        'type': 'object',\n        'properties': {\n            'age': {\n                'description': 'Age in years',\n                'minimum': 0,\n                'type': 'integer'\n            },\n            'firstName': {\n                'type': 'string'\n            },\n            'lastName': {\n                'type': 'string'\n            }\n        },\n        'required': [\n            'firstName',\n            'lastName'\n        ]\n    })\n\n    # validate this data\n    validator.validate({\n        'firstName': 'John',\n        'lastName': 'Noone',\n        'age': 33,\n    })\n\nOther examples can be found in the documentation_ or in the tests_.\n\n.. _`JSON Schema`: http://json-schema.org\n.. _`JSON Reference`: http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03\n.. _`JSON Pointer`: http://tools.ietf.org/html/rfc6901\n.. _`BSD license`: https://github.com/johnnoone/json-spec/blob/master/LICENSE\n.. _documentation: http://py.errorist.io/json-spec/\n.. _tests: https://github.com/johnnoone/json-spec/tree/master/tests\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnoone%2Fjson-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnoone%2Fjson-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnoone%2Fjson-spec/lists"}