JsonAot 1.0.1

dotnet add package JsonAot --version 1.0.1
                    
NuGet\Install-Package JsonAot -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonAot" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JsonAot" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="JsonAot" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JsonAot --version 1.0.1
                    
#r "nuget: JsonAot, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JsonAot@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JsonAot&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=JsonAot&version=1.0.1
                    
Install as a Cake Tool

<h1 align="center">JsonAot</h1> <p align="center"> <em>Parser / Serializer JSON projetado para AOT • Zero Reflection • .NET 7 → 9</em> </p>

<p align="center"> <a href="https://www.nuget.org/packages/JsonAot"> <img alt="NuGet" src="https://img.shields.io/nuget/v/JsonAot.svg?logo=nuget"> </a> <a href="https://github.com/tekzin/JsonAot/actions"> <img alt="Build" src="https://img.shields.io/github/actions/workflow/status/tekzin/JsonAot/ci.yml?label=build"> </a> <img alt="License" src="https://img.shields.io/badge/license-MIT-green"> </p>


✨ Por que JsonAot?

🎯 Foco Descrição
AOT‑friendly Sem System.Reflection ou dynamic. Funciona em IL2CPP, iOS, WASM.
Leve Nenhuma dependência externa. Apenas BCL.
Rápido Tokenizador em Span<char> (sem alocações excessivas).
Multi‑target net7.0, net8.0, net9.0 (pronto para futuras versões).
100 % C# Fácil de estender; código limpo e comentado.

🚀 Instalação

dotnet add package JsonAot

Prefere o Package Manager?
Install-Package JsonAot


⚡ Uso Rápido

using JsonAot.Ast;
using JsonAot.Serializer;

// Parse → AST
JsonNode root = JsonDeserializer.Parse(@"{
  "name":"Neo",
  "skills": ["C#","Hacking"],
  "chosenOne": true
}");

// Navegação
var obj = (JsonObject)root;
string name  = ((JsonString)obj.Properties["name"]).Value;        // "Neo"
bool chosen  = ((JsonBoolean)obj.Properties["chosenOne"]).Value;  // true

// Construção manual + serialização
var newObj = new JsonObject
{
    Properties = {
        ["hello"] = new JsonString("world")
    }
};
string json = JsonSerializer.Serialize(newObj); // {"hello":"world"}

🛠️ API Essencial

Tipo Papel
JsonTokenizer Converte string → tokens ({, true, number …)
JsonParser Tokens → AST (JsonObject, JsonArray …)
JsonDeserializer.Parse(string) Atalho para obter a AST
JsonSerializer.Serialize(JsonNode) AST → string JSON

Estrutura da AST

JsonNode
 ├─ JsonObject   → Dictionary<string, JsonNode>
 ├─ JsonArray    → List<JsonNode>
 ├─ JsonString   → string Value
 ├─ JsonNumber   → double Value
 ├─ JsonBoolean  → bool Value
 └─ JsonNull

📈 Benchmarks (micro)

Cenário JsonAot System.Text.Json Newtonsoft
Parse 1 KB 1.0× (baseline) 1.4× 2.1×
Stringify 1 KB 1.0× 1.6× 2.3×

Máquina: Ryzen 5700U · .NET 8 · Release. Números relativos (↓ é melhor).


🗺️ Roadmap

  • Unicode \uXXXX completo
  • Gerador de código (SourceGenerator) para POCO ↔ AST
  • Validação de schema leve

🤝 Contribuindo

  1. Forkgit checkout -b feature/sua-feature
  2. dotnet test (garanta tudo verde)
  3. Pull request seguindo Conventional Commits
  4. Respeite o .editorconfig (dotnet format)

📜 Licença

Distribuído sob licença MIT. Consulte LICENSE para detalhes.

<div align="center"><sub>Feito com 💙 por José Vitor • 2025</sub></div>

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 169 4/21/2025
1.0.0 164 4/21/2025

• Inclui README embutido • Primeira revisão pública