{"id":20690701,"url":"https://github.com/kaoticz/json2sharp","last_synced_at":"2026-03-07T18:08:31.981Z","repository":{"id":213211019,"uuid":"699178556","full_name":"Kaoticz/Json2Sharp","owner":"Kaoticz","description":"Convert JSON objects to class definitions.","archived":false,"fork":false,"pushed_at":"2026-03-01T19:37:49.000Z","size":261,"stargazers_count":8,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-01T19:49:01.697Z","etag":null,"topics":["cli","json","tool","utility"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kaoticz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["Kaoticz"],"patreon":null,"open_collective":null,"ko_fi":"kaoticz","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-10-02T05:12:38.000Z","updated_at":"2026-03-01T19:37:52.000Z","dependencies_parsed_at":"2023-12-19T09:44:01.281Z","dependency_job_id":"4d0a7d2c-1de1-467b-b24d-38952851a3c5","html_url":"https://github.com/Kaoticz/Json2Sharp","commit_stats":null,"previous_names":["kaoticz/json2sharp"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Kaoticz/Json2Sharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoticz%2FJson2Sharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoticz%2FJson2Sharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoticz%2FJson2Sharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoticz%2FJson2Sharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kaoticz","download_url":"https://codeload.github.com/Kaoticz/Json2Sharp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kaoticz%2FJson2Sharp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30225690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T17:00:40.062Z","status":"ssl_error","status_checked_at":"2026-03-07T17:00:39.026Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","json","tool","utility"],"created_at":"2024-11-16T23:14:01.073Z","updated_at":"2026-03-07T18:08:31.974Z","avatar_url":"https://github.com/Kaoticz.png","language":"C#","funding_links":["https://github.com/sponsors/Kaoticz","https://ko-fi.com/kaoticz"],"categories":[],"sub_categories":[],"readme":"[![.NET Unit Tests][.NET-Badge]][.NET-Url]\n[![CodeQL][CodeQL-Badge]][CodeQL-Url]\n[![CodeFactor][CodeFactor-Badge]][CodeFactor-Url]\n[![NuGet Downloads][Nuget-Downloads]][Nuget-Url]\n[![NuGet Badge][Nuget-Badge]][Nuget-Url]\n[![NuGet Nightly Badge][Nuget-Nightly-Badge]][Nuget-Url]\n\n# Json2Sharp\n\n\u003e *Because life is too short to map data by hand.*\n\nJson2Sharp is a CLI application that converts a JSON object to a class definition (or an equivalent for the target language).\n\nCurrently, C#, Java and Python are supported. We're open to contributions. If you'd like to add your favorite language to the mix, feel free to open a pull request!\n\n## Installation\n\nIf you have `dotnet` installed, you can install Json2Sharp as a NuGet tool.\n\n```bash\ndotnet tool install -g json2sharp-cli\n```\n\nOther packaging options are listed in the [wiki][GithubWiki].\n\n## Quick start\n\nPipe JSON data directly into Json2Sharp.\n\n```bash\n$ curl -s https://api.isevenapi.xyz/api/iseven/6 | json2sharp\nusing System.Text.Json.Serialization;\n\npublic sealed record Root(\n    [property: JsonPropertyName(\"ad\")] string Ad,\n    [property: JsonPropertyName(\"iseven\")] bool Iseven\n);\n```\n\nOr pass the JSON data to the `--json`/`-j` option.\n\n```bash\n$ json2sharp -j \"{ \\\"ad\\\": \\\"Some ad here\\\", \\\"iseven\\\": false }\"\nusing System.Text.Json.Serialization;\n\npublic sealed record Root(\n    [property: JsonPropertyName(\"ad\")] string Ad,\n    [property: JsonPropertyName(\"iseven\")] bool Iseven\n);\n```\n\nOr tell it to use a file as input.\n\n```bash\n$ json2sharp -i IsEven.json\nusing System.Text.Json.Serialization;\n\npublic sealed record Root(\n    [property: JsonPropertyName(\"ad\")] string Ad,\n    [property: JsonPropertyName(\"iseven\")] bool Iseven\n);\n```\n\nYou can also save the result to a file.\n\n```bash\n$ curl -s https://api.isevenapi.xyz/api/iseven/6 | json2sharp -o IsEven.cs\n$ cat IsEven.cs\nusing System.Text.Json.Serialization;\n\npublic sealed record Root(\n    [property: JsonPropertyName(\"ad\")] string Ad,\n    [property: JsonPropertyName(\"iseven\")] bool Iseven\n);\n```\n\nFor additional options, please visit the [wiki][GithubWiki].\n\n## NuGet\n\nJson2Sharp is also available as a library on NuGet. To add it to your .NET project, simply run the following command.\n\n```\ndotnet add package Json2Sharp\n```\n\nTo perform a conversion, call the `Parse` method from the `Json2Sharp` class.\n\n```cs\nstring code = Json2Sharp.Parse(\"Person\", \"\"\"{ \"id\": 1, \"name\": \"John\" }\"\"\");\n/*\n * using System.Text.Json.Serialization;\n *\n * public sealed record Person(\n *     [property: JsonPropertyName(\"id\")] int Id,\n *     [property: JsonPropertyName(\"name\")] bool Name\n * );\n */\n```\n\nYou can also customize the conversion by initializing a `Json2SharpOptions` object and populating its members to suit your needs.\n\n```cs\nJson2SharpOptions options = new()\n{\n    TargetLanguage = Language.CSharp,\n    CSharpOptions = new()\n    {\n        IsSealed = false,\n        IsPropertyRequired = false,\n        TargetType = CSharpObjectType.Class,\n        SerializationAttribute = CSharpSerializationAttribute.NewtonsoftJson\n    }\n};\n\nstring code = Json2Sharp.Parse(className, rawJson, options);\n/*\n * using Newtonsoft.Json;\n *\n * public sealed class Person\n * {\n *     [JsonProperty(\"id\")]\n *     public int Id { get; init; }\n *\n *     [JsonProperty(\"name\")]\n *     public string Name { get; init; }\n * }\n */\n```\n\n## License\n\nCopyright 2023 Kotz\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\u003e http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[GithubWiki]: ../../wiki\n[CodeFactor-Url]: https://www.codefactor.io/repository/github/kaoticz/json2sharp/overview/main\n[CodeFactor-Badge]: https://www.codefactor.io/repository/github/kaoticz/json2sharp/badge/main\n[.NET-Url]: ../../actions/workflows/dotnet.yml\n[.NET-Badge]: ../../actions/workflows/dotnet.yml/badge.svg\n[CodeQL-Url]: ../../actions/workflows/codeql.yml\n[CodeQL-Badge]: ../../actions/workflows/codeql.yml/badge.svg\n[Nuget-Badge]: https://img.shields.io/nuget/v/Json2Sharp.svg?label=NuGet\n[Nuget-Downloads]: https://img.shields.io/nuget/dt/Json2Sharp\n[Nuget-Nightly-Badge]: https://img.shields.io/nuget/vpre/Json2Sharp?color=00007f\u0026label=NuGet%20Nightly\n[Nuget-Url]: https://www.nuget.org/packages/Json2Sharp","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaoticz%2Fjson2sharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaoticz%2Fjson2sharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaoticz%2Fjson2sharp/lists"}