{"id":19196304,"url":"https://github.com/jsonx-org/javascript","last_synced_at":"2025-06-30T19:36:56.458Z","repository":{"id":143673830,"uuid":"196999247","full_name":"jsonx-org/javascript","owner":"jsonx-org","description":"Reference implementation of the JSONx specification for the JavaScript platform. [Work In Progress]","archived":false,"fork":false,"pushed_at":"2022-10-17T11:12:48.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-04T09:10:31.885Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsonx-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-07-15T12:58:37.000Z","updated_at":"2022-10-17T11:12:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c3597e0-4fb2-4676-9e2b-9343ecf4af66","html_url":"https://github.com/jsonx-org/javascript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonx-org%2Fjavascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonx-org%2Fjavascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonx-org%2Fjavascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonx-org%2Fjavascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsonx-org","download_url":"https://codeload.github.com/jsonx-org/javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271527,"owners_count":19774859,"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":[],"created_at":"2024-11-09T12:13:21.179Z","updated_at":"2025-02-23T04:43:49.639Z","avatar_url":"https://github.com/jsonx-org.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONx Framework for JavaScript\n\n\u003e **JSON Schema for the enterprise**\n\n## Abstract\n\nThe \u003cins\u003eJSONx Framework\u003c/ins\u003e is a collection of specifications and reference implementations that provide \u003cins\u003estructural\u003c/ins\u003e and \u003cins\u003efunctional\u003c/ins\u003e patterns intended to help developers work with JSON. The \u003cins\u003eJSONx Framework\u003c/ins\u003e defines the [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema], which is a \u003cins\u003eschema language\u003c/ins\u003e designed in close resemblance to the [XMLSchema\u003csup\u003e❐\u003c/sup\u003e][xmlschema] specification.\n\nThis document introduces the \u003cins\u003eJSONx Framework\u003c/ins\u003e, and presents a directory of links to its constituent parts and related resources.\n\n### Note\n\n_The \u003cins\u003eJSONx Framework for JavaScript\u003c/ins\u003e is work in progress, and does not yet have a functional implementation. The [\u003cins\u003eJSONx Framework for Java\u003c/ins\u003e][java], however, is fully implemented, offering a complete solution for the full spec of the [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema]._\n\n## Table of Contents\n\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e1 [\u003cins\u003eIntroduction\u003c/ins\u003e](#1-introduction)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e1.1 [Conventions Used in This Document](#11-conventions-used-in-this-document)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2 [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][#jsd]\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2.1 [Purpose](#21-purpose)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2.2 [Requirements](#22-requirements)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2.3 [Getting Started](#23-getting-started)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2.4 [JSD vs JSDx](#24-jsd-vs-jsdx)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e2.5 [\u003cins\u003eSpecification\u003c/ins\u003e](#25-specification)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e3 [\u003cins\u003eDocument Validation\u003c/ins\u003e](#3-document-validation)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e3.1 [Purpose](#31-purpose)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e3.2 [Requirements](#32-requirements)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e3.3 [Getting Started](#33-getting-started)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/samp\u003e3.4 [Specification](#34-specification)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e4 [\u003cins\u003eContributing\u003c/ins\u003e](#4-contributing)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e5 [\u003cins\u003eSpecial Thanks\u003c/ins\u003e](#5-special-thanks)\u003cbr\u003e\n\u003csamp\u003e\u0026nbsp;\u0026nbsp;\u003c/samp\u003e6 [\u003cins\u003eLicense\u003c/ins\u003e](#6-license)\n\n## \u003cb\u003e1\u003c/b\u003e \u003cins\u003eIntroduction\u003c/ins\u003e\n\nThe \u003cins\u003eJSONx Framework\u003c/ins\u003e was created to help developers address common problems and use-cases when working with JSON. The \u003cins\u003eJSONx Framework\u003c/ins\u003e offers \u003cins\u003estructural\u003c/ins\u003e and \u003cins\u003efunctional\u003c/ins\u003e patterns that systematically reduce errors and pain-points commonly encountered when developing software that interfaces with JSON. The \u003cins\u003estructural\u003c/ins\u003e patterns are defined in the [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema], which is a programming-language-agnostic \u003cins\u003eschema language\u003c/ins\u003e to describe constraints and document the meaning, usage and relationships of the constituent parts of JSON documents. The \u003cins\u003efunctional\u003c/ins\u003e patterns are reference implementations (on the Java platform) of the specification of the \u003cins\u003eschema language\u003c/ins\u003e, providing utilities that address common use-cases for applications that use JSON in one way or another. Common use-cases include:\n\n1. Definition of a normative contract between a producer and consumer of JSON documents.\n1. Validation of JSON documents conforming to a respective \u003cins\u003eschema document\u003c/ins\u003e.\n1. Java class binding capabilities for JSON documents conforming to a respective \u003cins\u003eschema document\u003c/ins\u003e.\n\n### \u003cb\u003e1.1\u003c/b\u003e Conventions Used in This Document\n\nThe key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\", \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119.txt).\n\n## \u003cb\u003e2\u003c/b\u003e \u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e\n\nDescribes JSON documents using schema components to constrain and document the meaning, usage and relationships of their constituent parts: value types and their content.\n\n### \u003cb\u003e2.1\u003c/b\u003e Purpose\n\nProvide a \u003cins\u003eschema language\u003c/ins\u003e to describe normative contracts between producer and consumer ends of a protocol exchanging JSON documents.\n\n### \u003cb\u003e2.2\u003c/b\u003e Requirements\n\n1. The \u003cins\u003eschema language\u003c/ins\u003e MUST constrain and document the meaning, usage, constraints and relationships of the constituent parts of a JSON document.\n\n1. The \u003cins\u003eschema language\u003c/ins\u003e MUST provide meaningful and useful constraint rules for the 5 JSON value types:\n\n   `boolean`, `number`, `string`, `object`, `array`.\n\n1. The \u003cins\u003eschema language\u003c/ins\u003e MUST support schema descriptions for any and all legal JSON documents, as specified by [RFC2119](https://www.ietf.org/rfc/rfc2119.txt).\n\n1. The \u003cins\u003eschema language\u003c/ins\u003e MUST be free-of and agnostic-to patterns specific to any particular programming language.\n\n1. The \u003cins\u003eschema language\u003c/ins\u003e MUST be able to describe itself.\n\n### \u003cb\u003e2.3\u003c/b\u003e Getting Started\n\nThe \u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e can be expressed in 2 forms: \u003cins\u003eJSD (Json Schema Document)\u003c/ins\u003e, and \u003cins\u003eJSDx (JSD in XML semantics)\u003c/ins\u003e.\n\nCreate `schema.jsd` or `schema.jsdx` with the following content:\n\n\u003c!-- tabs:start --\u003e\n\n###### **JSD**\n\n```json\n{\n  \"jx:ns\": \"http://www.jsonx.org/schema-0.3.jsd\",\n  \"jx:schemaLocation\": \"http://www.jsonx.org/schema-0.3.jsd http://www.jsonx.org/schema.jsd\",\n\n  \"myNumber\": { \"jx:type\": \"number\", \"range\": \"[-1,1)\" },\n  \"myString\": { \"jx:type\": \"string\", \"pattern\": \"[a-z]+\" },\n  \"myObject\": {\n    \"jx:type\": \"object\", \"properties\": {\n      \"myArray\": {\n        \"jx:type\": \"array\", \"elements\": [\n          { \"jx:type\": \"boolean\" },\n          { \"jx:type\": \"reference\", \"type\": \"myNumber\" },\n          { \"jx:type\": \"reference\", \"type\": \"myString\" },\n          { \"jx:type\": \"array\", \"elements\": [\n            { \"jx:type\": \"boolean\" },\n            { \"jx:type\": \"number\", \"range\": \"[0,100]\", \"scale\": 0 },\n            { \"jx:type\": \"string\", \"pattern\": \"[0-9]+\" },\n            { \"jx:type\": \"any\", \"types\": \"myNumber myString\" } ]},\n        { \"jx:type\": \"reference\", \"type\": \"myObject\" },\n        { \"jx:type\": \"any\", \"types\": \"myString myObject\" }]\n      }\n    }\n  }\n}\n```\n\n###### **JSDx**\n\n```xml\n\u003cschema\n  xmlns=\"http://www.jsonx.org/schema-0.3.xsd\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://www.jsonx.org/schema-0.3.xsd http://www.jsonx.org/schema.xsd\"\u003e\n\n  \u003cnumber name=\"myNumber\" range=\"[-1,1)\"/\u003e\n  \u003cstring name=\"myString\" pattern=\"[a-z]+\"/\u003e\n  \u003cobject name=\"myObject\"\u003e\n    \u003cproperty name=\"myArray\" xsi:type=\"array\"\u003e\n      \u003cboolean/\u003e\n      \u003creference type=\"myNumber\"/\u003e\n      \u003creference type=\"myString\"/\u003e\n      \u003carray\u003e\n        \u003cboolean/\u003e\n        \u003cnumber range=\"[0,100]\" scale=\"0\"/\u003e\n        \u003cstring pattern=\"[0-9]+\"/\u003e\n        \u003cany types=\"myNumber myString\"/\u003e\n      \u003c/array\u003e\n      \u003creference type=\"myObject\"/\u003e\n      \u003cany types=\"myString myObject\"/\u003e\n    \u003c/property\u003e\n  \u003c/object\u003e\n\n\u003c/schema\u003e\n```\n\n\u003c!-- tabs:end --\u003e\n\n\u003csub\u003e_**Note:** You can use the [Converter][#converter] utility to automatically convert between \u003cins\u003eJSD\u003c/ins\u003e and \u003cins\u003eJSDx\u003c/ins\u003e._\u003c/sub\u003e\n\nThis example defines a schema with 3 types that express the following structure:\n\n1. Type **`myNumber`**: A `number` between the range -1 (inclusive) and 1 (exclusive).\n1. Type **`myString`**: A `string` with the regex patter \"[a-z]+\".\n1. Type **`myObject`**: An `object` that has one property:\n   1. \"myArray\": An `array` that defines a sequence of elements:\n      1. `boolean`\n      1. **`myNumber`**\n      1. **`myString`**\n      1. An `array` with the following elements:\n         1. `boolean`\n         1. An integer `number` between 0 and 100.\n         1. A `string` of pattern \"[0-9]+\"\n         1. Either **`myNumber`** or **`myString`**.\n      1. `myObject`\n      1. Either **`myString`** or **`myObject`**.\n\n### \u003cb\u003e2.4\u003c/b\u003e JSD vs JSDx\n\nThe \u003cins\u003eJSDx\u003c/ins\u003e format offers XML validation, and using an XML IDE like [oXygen XML Editor\u003csup\u003e❐\u003c/sup\u003e][oxygenxml] offers edit-time XML validation, such as:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/1258414/61751752-aae93800-ada9-11e9-88b1-65de08f125b5.png\" width=\"75%\"\u003e\n\nWhen using the \u003cins\u003eJSDx\u003c/ins\u003e format with the [oXygen XML Editor\u003csup\u003e❐\u003c/sup\u003e][oxygenxml], the auto-completion features of the editor will guide you in writing the schema. With the \u003cins\u003eJSDx\u003c/ins\u003e format, the XML editor will also validate keys and keyrefs to ensure that declared types are referenced correctly.\n\n### \u003cb\u003e2.5\u003c/b\u003e Specification\n\n_For a detailed specification of the \u003cins\u003eschema language\u003c/ins\u003e, see **[\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema]**._\n\n## \u003cb\u003e3\u003c/b\u003e \u003cins\u003eDocument Validation\u003c/ins\u003e\n\nProvide a way for JSON documents whose structure is expressed in the [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema] to be \u003cins\u003evalidated\u003c/ins\u003e.\n\n### \u003cb\u003e3.1\u003c/b\u003e Purpose\n\nProvide a \u003cins\u003eValidator\u003c/ins\u003e for the validation of JSON documents against a JSD or JSDx.\n\n### \u003cb\u003e3.2\u003c/b\u003e Requirements\n\n1. The \u003cins\u003eValidator\u003c/ins\u003e MUST support the full scope of the [\u003cins\u003eJSON Schema Definition Language\u003c/ins\u003e][schema].\n\n1. The \u003cins\u003eValidator\u003c/ins\u003e MUST produce clear and useful error messages that identify the exact location of the error when validation errors are encountered.\n\n1. The \u003cins\u003eValidator\u003c/ins\u003e MUST be interoperable in Node.js and the browser.\n\n1. The \u003cins\u003eValidator\u003c/ins\u003e MUST be straightforward, intuitive, and resilient to human error.\n\n### \u003cb\u003e3.3\u003c/b\u003e Getting Started\n\nComing soon.\n\n### \u003cb\u003e3.4\u003c/b\u003e Specification\n\nComing soon.\n\n## \u003cb\u003e4\u003c/b\u003e \u003cins\u003eContributing\u003c/ins\u003e\n\nPull requests are welcome. For major changes, please [open an issue](../../issues) first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## \u003cb\u003e5\u003c/b\u003e \u003cins\u003eSpecial Thanks\u003c/ins\u003e\n\n[![Java Profiler](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png)](https://www.ej-technologies.com/products/jprofiler/overview.html)\n\u003cbr\u003e\u003csub\u003e_Special thanks to [EJ Technologies](https://www.ej-technologies.com/) for providing their award winning Java Profiler ([JProfiler](https://www.ej-technologies.com/products/jprofiler/overview.html)) for development of the JSONx Framework._\u003c/sub\u003e\n\n## \u003cb\u003e6\u003c/b\u003e \u003cins\u003eLicense\u003c/ins\u003e\n\nThis project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details.\n\n[#converter]: #532-converter\n[#jsd]: #3-json-schema-definition-language\n\n[java]: ../../../java\n[schema]: ../../../schema\n\n[oxygenxml]: https://www.oxygenxml.com/xml_editor/download_oxygenxml_editor.html\n[xmlschema]: http://www.w3.org/2001/XMLSchema","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonx-org%2Fjavascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsonx-org%2Fjavascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonx-org%2Fjavascript/lists"}