https://github.com/cdxoo/xson-utils
BSON and JSON related Command Line Utilities
https://github.com/cdxoo/xson-utils
bson command-line-tool json json-schema kotlin
Last synced: about 1 month ago
JSON representation
BSON and JSON related Command Line Utilities
- Host: GitHub
- URL: https://github.com/cdxoo/xson-utils
- Owner: cdxOo
- License: mit
- Created: 2020-03-22T01:34:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-29T02:17:12.000Z (about 6 years ago)
- Last Synced: 2025-02-08T16:14:18.592Z (over 1 year ago)
- Topics: bson, command-line-tool, json, json-schema, kotlin
- Language: Kotlin
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xson-utils
JVM based command line utilities for BSON and JSON written in Kotlin.
* bsontojson
Reads a BSON file and prints its contents as mongodb extended JSON.
Available mongodb-ext-json modes are "extended", "relaxed" and "shell". Default is "relaxed".
See the [mongodb-ext-json documentation](https://mongodb.github.io/mongo-java-driver/4.0/bson/extended-json/) for more information regarding the modes.
* json-schema-inferrer
Takes a JSON document or a collection of JSON documents from either STDIN or an input file and infers the json schema definition.
The utility is mostly just a wrapper for [sassquatch/json-schema-inferrer](https://github.com/saasquatch/json-schema-inferrer) library functions.
## Installation
In addition to the instuctions below, you can also download the utilities from the [release assets](https://github.com/cdxOo/xson-utils/releases).
### bsontojson
curl -sSLO https://github.com/cdxOo/xson-utils/releases/download/0.1.0-alpha/bsontojson \
&& chmod a+x bsontojson
# verify the executables sha512sum (optional but recommended)
curl -sSLO https://github.com/cdxOo/xson-utils/releases/download/0.1.0-alpha/bsontojson.sha512 \
&& sha512sum -c bsontojson.sha512 bsontojson
### json-schema-inferrer
curl -sSLO https://github.com/cdxOo/xson-utils/releases/download/0.1.0-alpha/json-schema-inferrer \
&& chmod a+x json-schema-inferrer
# verify the executables sha512sum (optional but recommended)
curl -sSLO https://github.com/cdxOo/xson-utils/releases/download/0.1.0-alpha/json-inferrer-schema.sha512 \
&& sha512sum -c json-inferrer-schema.sha512 json-schema-inferrer
## Usage
# bsontojson
bsontojson -m extended my-bson-file.bson
# json-schema-inferrer
json-schema-inferrer --help
echo '[{ "foo": "bar"}, { "foo": "baz" }]' | ./json-schema-inferrer
./json-schema-inferrer -f my-json-file.json