{"id":20294140,"url":"https://github.com/realchrisdebon/jsonaot","last_synced_at":"2025-06-23T20:07:27.913Z","repository":{"id":239079579,"uuid":"798474910","full_name":"realChrisDeBon/JsonAot","owner":"realChrisDeBon","description":"Streamlines automation for making your .NET project's json serialization work and comply with AOT requirements. Using System.Text.Json you will be able to easily output AOT compliant binaries without the hassle of manually generated source gen code for every class. Meant to be ran as a standalone binary.","archived":false,"fork":false,"pushed_at":"2024-05-09T21:40:46.000Z","size":558,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T05:29:23.689Z","etag":null,"topics":["automatic-code-generation","dot-net-8","dot-net-aot","json-aot","json-serialization","net-8"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/realChrisDeBon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-05-09T21:14:40.000Z","updated_at":"2024-05-09T21:40:49.000Z","dependencies_parsed_at":"2024-05-09T22:20:29.734Z","dependency_job_id":"3d5a1d14-1ab7-4658-963b-bf5f8c0e2ae0","html_url":"https://github.com/realChrisDeBon/JsonAot","commit_stats":null,"previous_names":["realchrisdebon/jsonaot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/realChrisDeBon/JsonAot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realChrisDeBon%2FJsonAot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realChrisDeBon%2FJsonAot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realChrisDeBon%2FJsonAot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realChrisDeBon%2FJsonAot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realChrisDeBon","download_url":"https://codeload.github.com/realChrisDeBon/JsonAot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realChrisDeBon%2FJsonAot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261548735,"owners_count":23175495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["automatic-code-generation","dot-net-8","dot-net-aot","json-aot","json-serialization","net-8"],"created_at":"2024-11-14T15:27:57.790Z","updated_at":"2025-06-23T20:07:27.885Z","avatar_url":"https://github.com/realChrisDeBon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003e\n\u003cimg src=\"https://github.com/realChrisDeBon/JsonAot/assets/97779307/15598c4d-eab5-414f-b349-c1010f610111\" width=\"175\" height=\"175\" alt=\"ConsoleDebugger logo\"\u003e\n  \n   JsonAot\n\u003c/h1\u003e\n\n## Json serialization solution for assembled-on-time publishing in .NET 8.0\n\nJsonAot is a lightweight utility designed to automate source generation code for your classes.\nIf you are trying to refactor or migrate your code into an AOT compliant format, you may find\nseveral Json serialization packages are not entirely AOT compliant and will break code, which\nwill lead you to consider using `System.Text.Json`. Rather than deal with the headache of \nimplementing a huge deal of refactoring, you can simply add the attribute `[JsonAot]` to your\nclasses that you intend to serialize or deserialize and JsonAot will handle the rest. Here's\nhow:\n\n**1. Run JsonAot -setup** Running JsonAot with the -setup parameter in your project's\nroot directory will create the JSONHandler.cs template file. Optionally you can add the\n-s arg during setup, `JsonAot -setup -s' and your 'Program.cs' file will be automatically\nupdated with the necessary including statement.\n\n*Note:* Manually add your project's namespace into the JSONHandler.cs file so it can access class references!\n\n**2. Implement functions** JSONHandler.cs has two built in functions which provide a very\nfamiliar syntax with Newtonsoft's and System.Text.Json's conversion syntax. Implement these\nfunction for your project's serialization and deserialization, and be sure to tag all classes\nthat will be passed to these function with `[JsonAot]`\n```csharp\n[JsonAot]\npublic class MessageExample{\n    public string Message {get; set; };\n    public int ID {get; set;}\n} // the attribute will tell JsonAot this class will be serialized\n```\n\n**3. Run JsonAot -run** Once all of your classes have been properly tagged with the JsonAot\nattribute, run `JsonAot -run` in the project root directory. A scan will be conducted of all\n*.cs project files, the proper classes identified, and JSONHandler.cs will be updated automatically with appropriate source code.\n\nAnd there you go, your Json serialization will work within the confines of an AOT binary!\n\n## Function usage\nIf there are no project-specific constraints, it is advised to use the following includes:\n\n```csharp\nglobal using static JSONHandler.JSONHandler;\nglobal using JSONHandler;\n```\n\nThis will make conversion much more functional and easy to implement throughout your application.\nSee below for examples of the built-in serialization functions.\n\n**Serialization:**\n```csharp\nMessageExample newmessage = new MessageExample(){\n    Message = \"Hello!\",\n    ID = 1000\n};\nstring serialized_object = Serialize\u003cMessageExample\u003e(newmessage);\n```\n\n**Deserialization:**\n```csharp\nMessageExample deserializedmessage = Deserialize\u003cMessageExample\u003e(serialized_object);\n```\n\n*Note:* JsonAot is meant to be ran as a binary in the project root, it is not a working NuGet package. Download and compile the binary, or check the release for a current working download.\n\n\u003csup\u003eIf you don't want to compile it yourself, there's a working x64 release\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealchrisdebon%2Fjsonaot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealchrisdebon%2Fjsonaot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealchrisdebon%2Fjsonaot/lists"}