2 stable releases

2.0.0 Sep 8, 2022
1.0.0 Dec 4, 2019

#1879 in Encoding

21 downloads per month

0BSD license

5KB
63 lines

JSON2CBOR

This repo contains two really simple programs to convert JSON to CBOR and vice versa. It does the transformation using serde-transcode.

Install

  1. Install Rust.
  2. cargo install json2cbor.

Use

json2cbor and cbor2json both take the same flags & arguments

Reads/writes to stdin/stdout by default

echo '{"foo":"bar"}' | json2cbor | cbor2json
# Output: {"foo":"bar"}

Read from an input file

json2cbor in.json

Write to an output file

echo '{"foo":"bar"}' | json2cbor -o out.cbor

Read & write to files

json2cbor -o out.cbor in.json

Get help

json2cbor --help

Dependencies

~4.5MB
~92K SLoC