json2sharp-cli 1.1.11

dotnet tool install --global json2sharp-cli --version 1.1.11
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.11
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=json2sharp-cli&version=1.1.11
nuke :add-package json2sharp-cli --version 1.1.11

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 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.

Version Downloads Last updated
1.1.11 66 6/7/2024
1.1.10 75 5/22/2024
1.1.9.1 79 5/13/2024
1.1.9 82 5/13/2024