explaingit

hadashia/nojsonschema

16C#Audience · developerComplexity · 2/5LicenseSetup · easy

TLDR

NoJsonSchema reads a JSON Schema file and generates C# classes with custom serialization code that has zero third-party dependencies, making it safe for Unity, native AOT, and trimmed .NET apps.

Mindmap

mindmap
  root((nojsonschema))
    What it does
      Reads JSON Schema
      Generates C# classes
      Custom serializer
      Custom deserializer
    Usage modes
      Source generator NuGet
      Command-line tool
      Library API
    Supported formats
      Draft 2020-12
      Draft-07
      OpenAPI 3.x
    Use cases
      Unity IL2CPP apps
      Native AOT builds
      Trimmed deployments
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Generate dependency-free C# classes from a JSON Schema for Unity games compiled with IL2CPP.

USE CASE 2

Add a NuGet source generator so C# types are auto-generated from schema files at build time.

USE CASE 3

Use the CLI tool to generate C# serialization code as part of a CI/CD build pipeline.

USE CASE 4

Parse OpenAPI 3.x schemas into C# types for apps using native AOT or aggressive code trimming.

Tech stack

C#.NETNuGet

Getting it running

Difficulty · easy Time to first run · 30min

No external runtime dependencies, works with standard .NET base class library only.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

NoJsonSchema is a tool for C# developers that reads a JSON Schema document and generates C# classes along with code to convert those classes to and from JSON. The main selling point is that the generated code has no third-party dependencies and works in environments where standard JSON libraries struggle, such as Unity games, applications compiled to native machine code, and trimmed deployments. A JSON Schema is a structured description of what a JSON document should look like, specifying which fields exist, what types they are, and which are required. NoJsonSchema takes that description and produces C# class definitions that match it, plus a serializer (which turns objects into JSON text) and a deserializer (which parses JSON text back into objects). Both are custom-built using low-level byte operations, which makes them somewhat faster than the built-in .NET JSON library. The generated files use only the standard .NET base class library, nothing from NuGet or any external package. This matters for Unity / IL2CPP (Unity's ahead-of-time compiler), native AOT compilation, and apps that use aggressive code trimming, where reflection-based JSON libraries often cause problems. There are three ways to use the tool. The first is a source generator: you add a NuGet package to your project, list your schema files in the project configuration, and the types are generated automatically at build time. The second is a command-line tool you can call as part of your own scripts or build pipeline. The third is a library API for integrating the generator into your own tooling. The tool supports JSON Schema Draft 2020-12, Draft-07, and OpenAPI 3.x documents. It can read schema files from local paths or directly from HTTP URLs. The project is released under the MIT License.

Copy-paste prompts

Prompt 1
Add NoJsonSchema as a source generator to my C# project so it auto-generates classes from my OpenAPI schema file at build time, show me the exact csproj changes needed.
Prompt 2
Use the NoJsonSchema CLI to generate C# serialization code from a JSON Schema Draft 2020-12 file, give me the command and explain what output files are created.
Prompt 3
I'm building a Unity game with IL2CPP and need dependency-free JSON parsing, show me how to use NoJsonSchema to generate the classes and serializer I need.
Prompt 4
I have a JSON Schema at a URL and want NoJsonSchema to fetch it and generate C# types, show me how to point the tool at an HTTP URL.
Open on GitHub → Explain another repo

← hadashia on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.