digitalbazaar / jsonld-cli

JSON-LD command line interface tool
Other
48 stars 7 forks source link

jsonld-cli

Introduction

This module provides a command line tool jsonld to manipulate JSON-LD data. It is written in JavaScript for Node.js and uses the jsonld.js and jsonld-request libraries. Inputs can be from stdin, URLs, or files.

Requirements

Installation

Install from NPM

npm install -g jsonld-cli

Use directly with npx

npx jsonld-cli ...

Usage

The jsonld command line tool can be used to:

To show tool options, a list of commands, or command options:

jsonld --help
jsonld COMMAND --help

To check JSON-LD for some common problems:

jsonld lint "https://example.com/data.json"

To compact a document on the Web using a JSON-LD context published on the Web:

jsonld compact -c "https://w3id.org/payswarm/v1" "http://recipes.payswarm.com/?p=10554"

The command above will read in a PaySwarm Asset and Listing in RDFa 1.0 format, convert it to JSON-LD expanded form, compact it using the 'https://w3id.org/payswarm/v1' context, and dump it out to the console in compacted form.

jsonld canonize -q "http://recipes.payswarm.com/?p=10554"

The command above will read in a PaySwarm Asset and Listing in RDFa 1.0 format, canonize the data using the RDF Dataset canonicalization algorithm, and then dump the output to canonized N-Quads format. The N-Quads can then be processed via SHA-256, or similar algorithm, to get a deterministic hash of the contents of the Dataset.

Security Considerations

Commercial Support

Commercial support for this library is available upon request from

Source Code

https://github.com/digitalbazaar/jsonld-cli