npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qson/js

v0.1.0

Published

Query String Object Notation - A JSON-like notation designed for URL query strings

Readme

QSON - Query String Object Notation

Example:

import { createQueryString,parseQueryString } from "qson";

const qs = createQueryString({ search:{ name:"qson",rating:5,public:true },slice:[ 1,10 ] });
// -> "search=(name:$qson$,public:true,rating:5)&slice=@(1,10)"
const search = parseQueryString(qs);
// -> { search:{ name:"qson",public:true,rating:5 },slice:[ 1,10 ]}

What is QSON

A JSON-like notation that can safely be used to store and transport JSON compatible data in URL query strings. It maintains decent human readability while being compatible with WHATWG standard and most tools and systems that handle query strings. By default, produced QSON strings and query strings are canonical for efficient usage as cache keys.

Capabilities:

  • Deterministic. Many systems use guesswork to determine data types when parsing query strings. "If it looks like a number, it must be a number" and "if it doesn't match any specific type, it must be a string". QSON has JSON-style deterministic serializing and parsing.
  • Somewhat human readable. JSON can be transferred as base64 encoded but this completely loses human readability unless it is decoded first. From QSON you can easily read data structure, numbers, booleans and null. Strings and object keys are percent-encoded so they maintain some human-readability unless they contain mostly characters that must be percent encoded e.g. characters completely outside ASCII plane.
  • JSON API compatible. Anything that can be serialized to JSON and parsed back should also be able to be serialized to QSON and parsed back. QSON supports <object>.toJSON methods and replacer and reviver functions just like JSON.

This package contains methods for creating and parsing QSON strings and helpers for creating and parsing complete query strings where values are QSON.

What QSON is not

Not a JSON replacement. JSON is still faster, more human-readable and also human-writable.

Not 100% compatible with all other tools and systems. If a QSON or QSON-containing query string is passed through percent decoder, the QSON structure can become corrupted.

API

ESM:

import { stringifyQSON,parseQSON,createQueryString,parseQueryString } from "qson";

TypeScript:

import type { SerializerOptions,ParserOptions } from "qson";

CJS:

const { stringifyQSON,parseQSON,createQueryString,parseQueryString } = require("qson");

Core:

stringifyQSON(data[,options])

  • data<object|array|string|boolean|null>
  • options<SerializerOptions>
    • replacer<function> a json api style replacer function
    • canonical<boolean> (default: true) sort object keys
  • returns<string>

Takes in any valid QSON (JSON) compatible data. Returns a QSON string representing the data.

parseQSON(text[,options])

  • text<string> QSON string
  • options<ParserOptions>
    • reviver<function> a json api style reviver function
  • returns<object|array|string|boolean|null>

Takes in any valid QSON string. Returns corresponding JS data.

Helpers:

createQueryString(data[,options])

  • data<object>
  • options<SerializerOptions>
    • replacer<function> a json api style replacer function
    • canonical<boolean> (default: true) sort object keys
  • returns<string>

Takes in an object where keys are query string keys and values are any QSON (JSON) compatible data. Returns query string (without leading '?') where values are QSON encoded. Replacer function is run on each entry in data (query object) but not for the query object itself.

parseQueryString(text[,options])

  • text<string> query string where values are QSON encoded
  • options<ParserOptions>
    • reviver<function> a json api style reviver function
  • returns<object>

Takes in a query string (without leading '?') where values are QSON encoded. Returns an object where keys are query string keys and values are JS data. Reviver function is run on each entry in the resulting query object but not for the query object itself.

Types:

Package includes TypeScript types.