{"id":19346096,"url":"https://github.com/jsonurl/jsonurl-js","last_synced_at":"2026-03-08T15:35:58.735Z","repository":{"id":36960742,"uuid":"247082147","full_name":"jsonurl/jsonurl-js","owner":"jsonurl","description":"JSON-\u003eURL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986). This repository holds the JavaScript reference implementation of JSON-\u003eURL.","archived":false,"fork":false,"pushed_at":"2024-10-30T04:59:00.000Z","size":3192,"stargazers_count":43,"open_issues_count":17,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-30T07:30:45.239Z","etag":null,"topics":["javascript","javascript-library","jsonurl","npm-module","npm-package","rollup-js","uri","url"],"latest_commit_sha":null,"homepage":"http://www.jsonurl.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsonurl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-13T13:50:13.000Z","updated_at":"2024-10-22T15:01:55.000Z","dependencies_parsed_at":"2023-09-28T00:14:36.462Z","dependency_job_id":"218df27a-a51e-494b-a15b-42a576ce374c","html_url":"https://github.com/jsonurl/jsonurl-js","commit_stats":{"total_commits":489,"total_committers":8,"mean_commits":61.125,"dds":0.5541922290388548,"last_synced_commit":"f38d5e6ba39593f106ccac12387d15360f416048"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonurl%2Fjsonurl-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonurl%2Fjsonurl-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonurl%2Fjsonurl-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsonurl%2Fjsonurl-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsonurl","download_url":"https://codeload.github.com/jsonurl/jsonurl-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"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":["javascript","javascript-library","jsonurl","npm-module","npm-package","rollup-js","uri","url"],"created_at":"2024-11-10T04:08:55.709Z","updated_at":"2026-03-08T15:35:58.692Z","avatar_url":"https://github.com/jsonurl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON→URL\n\n[![License: MIT](https://img.shields.io/github/license/jsonurl/jsonurl-js.svg?label=License)][license]\n[![NPM version](https://img.shields.io/npm/v/@jsonurl/jsonurl.svg)](https://www.npmjs.com/package/@jsonurl/jsonurl)\n[![CI](https://github.com/jsonurl/jsonurl-js/workflows/ci/badge.svg?branch=main)](https://github.com/jsonurl/jsonurl-js/actions/workflows/ci.yml)\n[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=jsonurl-js\\\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=jsonurl-js)\n[![Known Vulnerabilities](https://snyk.io/test/github/jsonurl/jsonurl-js/badge.svg?targetFile=package.json)](https://snyk.io/test/github/jsonurl/jsonurl-js?targetFile=package.json)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js?ref=badge_shield)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green)](CONTRIBUTING.md)\n[![project chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://jsonurl.zulipchat.com/)\n\n## About\n\n[RFC8259][RFC8259] describes the JSON data model and interchange format, which is widely\nused in application-level protocols including RESTful APIs. It is common for\napplications to request resources via the HTTP POST method, with JSON entities.\nHowever, POST is suboptimal for requests which do not modify a resource's\nstate. JSON→URL defines a text format for the JSON data model suitable\nfor use within a [URL][RFC1738]/[URI][RFC3986].\n\n## Usage\n\nJSON→URL is available as a commonjs module (suitable for use in Node), ES6\nmodule, or a script that may be used directly in a browser.\n\n### NPM install\n\n```sh\nnpm install @jsonurl/jsonurl --save\n```\n\n### CJS\n\n```js\nconst JsonURL = require(\"@jsonurl/jsonurl\");\n```\n\n### ES6 (Node + Babel)\n\n```js\nimport JsonURL from \"@jsonurl/jsonurl\";\n```\n\n### Browser script tag\n\n```html\n\u003cscript\n    src=\"https://cdn.jsdelivr.net/npm/@jsonurl/jsonurl@1.1.8\"\n    integrity=\"sha512-LIJoXzT8Z9ZYDVCop/RciWbhJCDBzOevskMv9YPLHI8kGUtJ32DHHDWdIBLBmMoKkMr7vsZEysOrOBbVg7yioA==\"\n    crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n```\n\n### The JavaScript API\n\nOnce included, the API is the same for all three.\n\n[![RunKit: Hello, World!](https://img.shields.io/badge/RunKit-Hello%2C%20World!-ff69b4)][runkit1]\n\n```js\nlet value = JsonURL.parse( \"(Hello:World!)\" );\nlet string = JsonURL.stringify( value );\n```\n\nIf you intend to use JSON→URL inside a browser's address bar then you'll want to\nenable the AQF (address bar query string friendly) syntax.\n\n[![RunKit: Hello, Browser Address Bar!](https://img.shields.io/badge/RunKit-Hello%2C%20Address%20Bar!-ff69b4)][runkit2]\n\n```js\nlet value = JsonURL.parse( \"(Hello:Address Bar!!)\",  { AQF: true });\nlet string = JsonURL.stringify( value,  { AQF: true } );\n```\n\n### Options - noEmptyComposite\n\nThe JSON→URL specification defines the empty composite value, `()`, because an\nempty array is indistinguishable from an empty object. This works well in\npractice, generally, but it can lead to counterintuitive results when parsing\nJSON→URL text into a language-native object and then stringifying it back\ninto JSON→URL text; the input text doesn't \"round-trip\" back to\nitself as expected.\n\nThe `noEmptyComposite` parse option causes the character sequence `()` to be\nparsed as an empty array, and the character sequence `(:)` to be parsed as an\nempty object. And the `noEmptyComposite` stringify option instructs\n`stringify` to generate those strings appropriately.\n\n[![RunKit: noEmptyComposite](https://img.shields.io/badge/RunKit-noEmptyComposite-ff69b4)][runkit3]\n\n```js\nlet value = JsonURL.parse( \"(Array:(true,false,(nested),()),Object:(nested:(:)))\",  { AQF: true, noEmptyComposite: true });\nlet string = JsonURL.stringify( value,  { AQF: true, noEmptyComposite: true });\n```\n\n### Options - More\n\nThere are additional options available. The [typescript definition][dts] file\nis a good place to learn more.\n\nJSON→URL has no runtime dependencies.\n\n## Security\n\nThe parser is designed to parse untrusted input. It supports limits on\nthe number of parsed values and depth of nested arrays or objects.\nWhen the limit is exceeded an Error is thrown, and reasonable limit values are\nset by default.\n\n[RFC8259]: https://tools.ietf.org/html/rfc8259\n\n[RFC3986]: https://tools.ietf.org/html/rfc3986\n\n[RFC1738]: https://tools.ietf.org/html/rfc1738\n\n[license]: https://opensource.org/licenses/MIT\n\n[runkit1]: https://runkit.com/jsonurl/hello-world\n\n[runkit2]: https://runkit.com/jsonurl/hello-aqf\n\n[runkit3]: https://runkit.com/jsonurl/noemptycomposite\n\n[dts]: https://github.com/jsonurl/jsonurl-js/blob/main/jsonurl.d.ts\n\n## License\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fjsonurl%2Fjsonurl-js?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonurl%2Fjsonurl-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsonurl%2Fjsonurl-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsonurl%2Fjsonurl-js/lists"}