json2sharp-cli
1.1.10
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global json2sharp-cli --version 1.1.10
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local json2sharp-cli --version 1.1.10
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=json2sharp-cli&version=1.1.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package json2sharp-cli --version 1.1.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Json2SharpApp
Json2Sharp is a CLI application that converts a JSON object to a programming language type definition (i.e. a class).
Quick start
Pipe JSON data directly into Json2Sharp.
$ curl -s https://api.isevenapi.xyz/api/iseven/6 | json2sharp
using System.Text.Json.Serialization;
public sealed record Root(
[property: JsonPropertyName("ad")] string Ad,
[property: JsonPropertyName("iseven")] bool Iseven
);
Or pass the JSON data to the --json
/-j
option.
$ json2sharp -j "{ \"ad\": \"Some ad here\", \"iseven\": false }"
using System.Text.Json.Serialization;
public sealed record Root(
[property: JsonPropertyName("ad")] string Ad,
[property: JsonPropertyName("iseven")] bool Iseven
);
Or tell it to use a file as input.
$ json2sharp -i IsEven.json
using System.Text.Json.Serialization;
public sealed record Root(
[property: JsonPropertyName("ad")] string Ad,
[property: JsonPropertyName("iseven")] bool Iseven
);
You can also save the result to a file.
$ curl -s https://api.isevenapi.xyz/api/iseven/6 | json2sharp -o IsEven.cs
$ cat IsEven.cs
using System.Text.Json.Serialization;
public sealed record Root(
[property: JsonPropertyName("ad")] string Ad,
[property: JsonPropertyName("iseven")] bool Iseven
);
For additional options, please visit the wiki.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.