dotnet-json
0.4.1
See the version list below for details.
dotnet tool install --global dotnet-json --version 0.4.1
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-json --version 0.4.1
#tool dotnet:?package=dotnet-json&version=0.4.1
nuke :add-package dotnet-json --version 0.4.1
dotnet-json
dotnet-json is a command line tool for working with and manipulating JSON files for example in CI/CD pipelines.
dotnet-json allows you to do basic manipulation of JSON files like setting the value of a specific (nested) key, or deleting a key, as well as merging two or more JSON files into one.
Installation
dotnet-json can be installed as a .NET Core (global) tool or be downloaded directly from the GitHub releases.
To install dotnet-json as a global tool, run the following command:
dotnet tool install -g dotnet-json
Or, if you already have dotnet-json
installed and want to update it to the latest version, run the following command:
dotnet tool update -g dotnet-json
Usage
When you installed dotnet-json as a .NET Core global tool, you can run it as either dotnet json
or dotnet-json
.
dotnet-json has 5 sub-commands, merge
, set
, remove
, get
and indent
.
Merge
Merges two or more files into the first, writing it back to the first file or into a specified output file.
Usage:
dotnet json merge <input file> <merge files...> [-o|--output <output file>]
Arguments:
- <input file> The first JSON file used as base to merge the other files' contents into, also used as default output
- <merge files...> One or more JSON files that are merged into the first file
Options:
- -o|--output file Write the merge result to a custom output file instead of using the input file
Set
Set a specific value in the JSON file. Use :
as separator for nesting objects.
Usage:
dotnet json set <file> <key> <value> [-o|--output <output file>]
Arguments:
- <file> The file to read the JSON from and write the result to unless
-o
is given. - <key> The key to update or create, use
:
to separate nested objects. - <value> The value to set the key to
Options:
- -o|--output file Write the result to a custom output file instead of using the input file
remove
Removes a key/value pair or complex object from a JSON file.
Usage:
dotnet json remove <file> <key> [-o|--output <output file>]
Arguments:
- <file> The file to read the JSON from and write the result to unless
-o
is given. - <key> The key to remove from the read JSON
Options:
- -o|--output file Write the result to a custom output file instead of using the input file
get
Reads the json file and returns the value for the given key.
Usage:
dotnet json get <file> <key> [-e|--exact]
Arguments:
- <file> The file to read the JSON from.
- <key> The key to output
Options:
- -e|--exact only return an exact value, this will return an error if the key references an object or array.
indent
Reads the json file and writes it out with indentation.
Usage:
dotnet json indent <file> [-o|--output <output file>]
Arguments:
- <file> The file to read the JSON from and write the result to unless
-o
is given.
Options:
- -o|--output file Write the result to a custom output file instead of writing back to the input file
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.1.4 | 39,999 | 4/16/2023 |
1.1.3 | 159 | 4/16/2023 |
1.1.2 | 163 | 4/16/2023 |
1.1.1 | 6,627 | 10/25/2022 |
1.1.0 | 6,682 | 7/20/2022 |
1.0.2 | 885 | 7/13/2022 |
1.0.1 | 5,989 | 2/12/2022 |
1.0.0 | 3,549 | 5/15/2021 |
0.5.0 | 686 | 1/31/2021 |
0.4.2 | 515 | 11/4/2020 |
0.4.1 | 17,979 | 10/23/2020 |
0.4.0 | 453 | 10/16/2020 |
0.3.0 | 420 | 10/3/2020 |
0.2.0 | 392 | 10/1/2020 |
0.1.1 | 441 | 9/30/2020 |
0.1.0 | 448 | 9/30/2020 |