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

@transportial/gsjson

v1.0.15

Published

JSON Getter and Setter language — JavaScript port of the GSJson Kotlin library. Fast, concise path syntax for reading and writing values in JSON documents.

Downloads

753

Readme

@transportial/gsjson

A fast, concise JSON Getter and Setter language for JavaScript.

This is the JavaScript port of the GSJson Kotlin library, allowing you to use a powerful path syntax to read, write, filter, and transform JSON data with ease.

Installation

npm install @transportial/gsjson

Quick Start

import GSJson from '@transportial/gsjson';

const data = {
  store: {
    book: [
      { category: "reference", author: "Nigel Rees", title: "Sayings of the Century", price: 8.95 },
      { category: "fiction", author: "J. R. R. Tolkien", title: "The Lord of the Rings", price: 22.99 }
    ]
  }
};

// Simple dot notation
const firstAuthor = GSJson.get(data, 'store.book.[0].author'); 
// "Nigel Rees"

// Wildcards and Modifiers
const prices = GSJson.get(data, 'store.book.[*].price'); 
// [8.95, 22.99]

// Filtering
const fiction = GSJson.get(data, 'store.book.[category == "fiction"]'); 
// [{ category: "fiction", ... }]

Features and Syntax

GSJson supports an extensive and highly flexible path language:

Basic Selectors

  • Dot notation: name.first
  • Escaped dots: fav\.movie
  • Array index: children.[0]
  • Array length: children.[#]
  • All child values: friends.[#.firstName]

Advanced Querying

  • Wildcards: *.name or name.fir?t
  • Filtering:
    • friends.[age > "40"].first
    • friends.[last == "Murphy"].first
    • friends.[first % "D*"].last (like/glob)
    • friends.[first !% "D*"].[0].first (not-like)
  • Back-references: friends.[age == <<.age].[0].first (cross-references a parent node)
  • Nested multi-query: friends.[nets.[# == "fb"]].[#.first]

Modifiers (Pipes)

Transform data right in your query using the | operator:

  • Formatting: |@pretty, |@ugly, |@tostr, |@fromstr
  • Arrays/Objects: |@reverse, |@sort, |@sortBy:age:desc, |@flatten, |@keys, |@values
  • Aggregators: |@count, |@sum, |@avg, |@min, |@max, |@join:", "
  • Math: |@multiply:2, |@add:5, |@round:2, |@abs
  • Advanced Array Ops: |@flatMap:path, |@filter:field == "value", |@groupBy:field, |@unique

JSON Lines

GSJson natively supports processing JSON Lines (newline-delimited JSON) by starting your path with ..:

  • Length: ..#
  • Indexed access: ..[1].name
  • Field extraction: ..#.name

API Reference

GSJson.get(data, path, [defaultValue])

Retrieves the value at the given path. Returns defaultValue (or undefined) if not found.

GSJson.set(data, path, value)

Sets a value at the given path. If intermediate objects/arrays don't exist, they are created. Returns a new JSON string representing the mutated object.

GSJson.exists(data, path)

Returns a boolean indicating if the path resolves to a non-null/undefined value.

GSJson.getResult(data, path)

Returns a rich GSJsonResult object containing helper methods for type conversion (e.g. .string(), .int(), .array()).

GSJson.forEachLine(jsonLines, action)

Iterates over a string of JSON Lines, executing the action callback for each parsed line. Return false from the callback to stop iteration.


License: Apache-2.0
Author: Transportial BV