
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
@jsonurl/jsonurl
Advanced tools
JSON->URL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986).
RFC8259 describes the JSON data model and interchange format, which is widely used in application-level protocols including RESTful APIs. It is common for applications to request resources via the HTTP POST method, with JSON entities. However, POST is suboptimal for requests which do not modify a resource's state. JSON→URL defines a text format for the JSON data model suitable for use within a URL/URI.
JSON→URL is available as a commonjs module (suitable for use in Node), ES6 module, or a script that may be used directly in a browser.
npm install @jsonurl/jsonurl --save
const JsonURL = require("@jsonurl/jsonurl");
import JsonURL from "@jsonurl/jsonurl";
<script
src="https://cdn.jsdelivr.net/npm/@jsonurl/jsonurl@1.1.8"
integrity="sha512-LIJoXzT8Z9ZYDVCop/RciWbhJCDBzOevskMv9YPLHI8kGUtJ32DHHDWdIBLBmMoKkMr7vsZEysOrOBbVg7yioA=="
crossorigin="anonymous"></script>
Once included, the API is the same for all three.
let value = JsonURL.parse( "(Hello:World!)" );
let string = JsonURL.stringify( value );
If you intend to use JSON→URL inside a browser's address bar then you'll want to enable the AQF (address bar query string friendly) syntax.
let value = JsonURL.parse( "(Hello:Address Bar!!)", { AQF: true });
let string = JsonURL.stringify( value, { AQF: true } );
The JSON→URL specification defines the empty composite value, ()
, because an
empty array is indistinguishable from an empty object. This works well in
practice, generally, but it can lead to counterintuitive results when parsing
JSON→URL text into a language-native object and then stringifying it back
into JSON→URL text; the input text doesn't "round-trip" back to
itself as expected.
The noEmptyComposite
parse option causes the character sequence ()
to be
parsed as an empty array, and the character sequence (:)
to be parsed as an
empty object. And the noEmptyComposite
stringify option instructs
stringify
to generate those strings appropriately.
let value = JsonURL.parse( "(Array:(true,false,(nested),()),Object:(nested:(:)))", { AQF: true, noEmptyComposite: true });
let string = JsonURL.stringify( value, { AQF: true, noEmptyComposite: true });
There are additional options available. The typescript definition file is a good place to learn more.
JSON→URL has no runtime dependencies.
The parser is designed to parse untrusted input. It supports limits on the number of parsed values and depth of nested arrays or objects. When the limit is exceeded an Error is thrown, and reasonable limit values are set by default.
FAQs
JSON->URL defines a text format for the JSON data model suitable for use within a URL/URI (as described by RFC3986).
The npm package @jsonurl/jsonurl receives a total of 5,454 weekly downloads. As such, @jsonurl/jsonurl popularity was classified as popular.
We found that @jsonurl/jsonurl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.