Socket
Socket
Sign inDemoInstall

@hyperjump/json

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hyperjump/json

JSON parser and stringifier with JSON Pointer support


Version published
Weekly downloads
17K
increased by12.06%
Maintainers
1
Install size
60.6 kB
Created
Weekly downloads
 

Readme

Source

Json

This is a reimplementation of the builtin JSON object to add JSON Pointer parameters to the "reviver" and "replacer" functions. Other than the added parameters, the interface and behavior is the same as the original.

Installation

Includes support for node.js (ES Modules, TypeScript) and browsers.

npm install @hyperjump/json

Usage

import * as Json from "@hyperjump/json";

const subject = `{
  "type": "object",
  "properties": {
    "foo": { "type": "string" },
    "bar": { "$ref": "#/$defs/number" }
  },
  "required": ["foo", "bar"],

  "$defs": {
    "number": { "type": "number" }
  }
}`;
const result = Json.parse(subject, (key, value, pointer) => {
  console.log("REVIVER", pointer, key, JSON.stringify(value));
  return value;
});

const json = Json.stringify(result, (key, value, pointer) => {
  console.log("REPLACER", pointer, key, value);
  return value;
}, "  ");

Contributing

Tests

Run the tests

npm test

Run the tests with a continuous test runner

npm test -- --watch

Keywords

FAQs

Last updated on 23 Jan 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc