Socket
Socket
Sign inDemoInstall

json-source-map

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-source-map

Parse/stringify JSON and provide source-map for JSON-pointers to all nodes


Version published
Weekly downloads
288K
decreased by-4.71%
Maintainers
1
Weekly downloads
 
Created

What is json-source-map?

The json-source-map npm package is used to generate a source map for JSON objects. This allows you to track the location of each key and value in the original JSON string, which can be useful for error reporting, debugging, and other tasks that require precise location information.

What are json-source-map's main functionalities?

Generating Source Map

This feature allows you to parse a JSON string and generate a source map that provides the location of each key and value in the original JSON string. The `pointers` object contains the location information.

const jsonSourceMap = require('json-source-map');
const json = '{"key": "value"}';
const { data, pointers } = jsonSourceMap.parse(json);
console.log(pointers);

Retrieving Location Information

This feature allows you to retrieve the location information for a specific key or value in the JSON object. The `pointers` object can be used to access the location of any key or value using a JSON Pointer.

const jsonSourceMap = require('json-source-map');
const json = '{"key": "value"}';
const { data, pointers } = jsonSourceMap.parse(json);
const keyLocation = pointers['/key'];
console.log(keyLocation);

Other packages similar to json-source-map

Keywords

FAQs

Package last updated on 12 Jan 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc