New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-joy

Package Overview
Dependencies
Maintainers
0
Versions
262
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-joy

Collection of libraries for building collaborative editing apps.

  • 17.29.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
195K
increased by119.11%
Maintainers
0
Weekly downloads
 
Created

What is json-joy?

The json-joy npm package provides a set of tools for working with JSON data, including JSON Patch, JSON CRDT (Conflict-free Replicated Data Types), and JSON Schema validation. It is designed to facilitate collaborative applications and data synchronization.

What are json-joy's main functionalities?

JSON Patch

JSON Patch allows you to apply a series of operations to a JSON document. The code sample demonstrates how to replace the value of a key in a JSON object.

const { applyPatch } = require('json-joy/lib/json-patch');

const document = { foo: 'bar' };
const patch = [{ op: 'replace', path: '/foo', value: 'baz' }];
const result = applyPatch(document, patch);
console.log(result); // { foo: 'baz' }

JSON CRDT

JSON CRDTs (Conflict-free Replicated Data Types) enable collaborative editing and data synchronization. The code sample shows how to create a CRDT and apply an operation to set a value.

const { createCRDT } = require('json-joy/lib/crdt');

const crdt = createCRDT();
crdt.apply({ type: 'set', path: '/foo', value: 'bar' });
console.log(crdt.state); // { foo: 'bar' }

JSON Schema Validation

JSON Schema Validation allows you to validate JSON documents against a schema. The code sample demonstrates how to validate a JSON object against a schema.

const { validate } = require('json-joy/lib/json-schema');

const schema = { type: 'object', properties: { foo: { type: 'string' } }, required: ['foo'] };
const document = { foo: 'bar' };
const result = validate(schema, document);
console.log(result.valid); // true

Other packages similar to json-joy

Keywords

FAQs

Package last updated on 15 Feb 2025

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