json2yaml 1.0.3

json2yaml is .NET global tool for converting json to yaml

dotnet tool install --global json2yaml --version 1.0.3
This package contains a .NET Core Global Tool you can call from the shell/command line.

json2yaml


A simple tool to convert json to yaml.

json2yaml converter reads json input (from file, url endpoint or stdin) and produces converted yaml output (to file or stdout).

Usage


Usage: json2yaml [options]

Options:
  -i|--input           Path to json input file. I.e. `-i:file.json` (or `-i="file.json"`). If empty value provided (`-i`), converter will search current directory for *.json file
  -u|--url             HTTP endpoint to fetch json input from
  -c|--console-output  [Optional]. Flag specifies if converted yaml should be printed directly to console. (In this case -o option is ignorred)
  -o|--output          [Conditionally Optional]. Path to output yaml file. I.e. `-o:file.yaml (or -o="file.yaml")`. Optional only with -i or -c option. If omitted or empty value provided ('-o') converter will output to file named like input, but with .yaml extension
  -m|--max-size        [Optional]. Specifies size limit for file to be converted. I.e. `-m:10`. If omitted, converter will skip file larger that 20 MB. Respected only when used together with -i option
  --version            Shows tool version. If more options are provided this option is ignored
  -?|-h|--help         Show help information

Examples


The simplest use case to take input from file:

json2yaml -i

This will search current directory for json file. Convert its contents to yaml. And writes output to file named as input file, but with extension .yaml.

For remote input use this:

json2yaml -u:https://localhost:5001/swagger/v1/swagger.json -o:swagger.yaml

Note. For --url option either --output or flag --console-output is required.

To print conversion results directly to console use -c|--console-output flag:

json2yaml -i:input.json -c

Read input from stdin:

cat test.json | json2yaml -o:output.yaml

Tool supports full piping scenarios:

cat swagger.json | json2yaml -c | grep version

json2yaml


A simple tool to convert json to yaml.

json2yaml converter reads json input (from file, url endpoint or stdin) and produces converted yaml output (to file or stdout).

Usage


Usage: json2yaml [options]

Options:
  -i|--input           Path to json input file. I.e. `-i:file.json` (or `-i="file.json"`). If empty value provided (`-i`), converter will search current directory for *.json file
  -u|--url             HTTP endpoint to fetch json input from
  -c|--console-output  [Optional]. Flag specifies if converted yaml should be printed directly to console. (In this case -o option is ignorred)
  -o|--output          [Conditionally Optional]. Path to output yaml file. I.e. `-o:file.yaml (or -o="file.yaml")`. Optional only with -i or -c option. If omitted or empty value provided ('-o') converter will output to file named like input, but with .yaml extension
  -m|--max-size        [Optional]. Specifies size limit for file to be converted. I.e. `-m:10`. If omitted, converter will skip file larger that 20 MB. Respected only when used together with -i option
  --version            Shows tool version. If more options are provided this option is ignored
  -?|-h|--help         Show help information

Examples


The simplest use case to take input from file:

json2yaml -i

This will search current directory for json file. Convert its contents to yaml. And writes output to file named as input file, but with extension .yaml.

For remote input use this:

json2yaml -u:https://localhost:5001/swagger/v1/swagger.json -o:swagger.yaml

Note. For --url option either --output or flag --console-output is required.

To print conversion results directly to console use -c|--console-output flag:

json2yaml -i:input.json -c

Read input from stdin:

cat test.json | json2yaml -o:output.yaml

Tool supports full piping scenarios:

cat swagger.json | json2yaml -c | grep version

Release Notes

1.0.3:
* add --version option. It shows only version string
* fix incorrect message when -u|--url option value is missing
* fix incorrect message when -m|--max-size option value is missing
1.0.2:
* return error if json2yaml is run with no options in stdin mode (i.e. echo 5 | json2yaml)
1.0.1:
* bump versions of dependencies
* use MIT licence identifier in package
1.0.0:
* read input from redirected stdin. Full piping scenarious is supported
0.4.0:
* -c|--console-output: print output results directly to console
0.3.2:
* fix json2yaml -i throws when run on directory without any *.json file
* fix message when json size exceeds value provided with --max-size option
0.3.1:
* support array in root
0.3.0:
* -u|--url option to read input from http endpoint
* show tool version
0.2.0:
* -m|--max-size option
0.1.2-alpha:
* cleanup tool output to console
0.1.1-alpha:
* handle gracefully command line parsing errors

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
1.0.3 53 7/7/2019
1.0.2 74 6/13/2019
1.0.1 74 5/18/2019
1.0.0 89 5/15/2019
0.4.0 346 4/6/2019
0.3.2 229 1/20/2019
0.3.1 119 12/17/2018
0.3.0 180 12/9/2018
0.2.0 96 11/24/2018
0.1.2-alpha 171 11/14/2018
0.1.1-alpha 95 11/8/2018
0.1.0-alpha 91 11/6/2018