Jsoon 1.0.3

dotnet add package Jsoon --version 1.0.3
                    
NuGet\Install-Package Jsoon -Version 1.0.3
                    
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="Jsoon" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jsoon" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Jsoon" />
                    
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 Jsoon --version 1.0.3
                    
#r "nuget: Jsoon, 1.0.3"
                    
#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 Jsoon@1.0.3
                    
#: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=Jsoon&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Jsoon&version=1.0.3
                    
Install as a Cake Tool

Jsoon

NuGet Build & Publish License: MIT


Jsoon é uma biblioteca estática e enxuta para serialização e desserialização JSON no .NET, baseada em System.Text.Json, com opções padronizadas e tratamento de erro customizado.


Instalação

No terminal do seu projeto:

dotnet add package Jsoon

Como usar

using Jsoon;

var pessoa = new Pessoa { Nome = "Rodrigo", Idade = 30 };

// Serializa para JSON
string json = Jsoon.Serializer.Serialize(pessoa);

// Desserializa de JSON
var pessoa2 = Jsoon.Serializer.Deserialize<Pessoa>(json);

Por que usar o Jsoon?

  • Pronto para produção: utiliza camelCase, case-insensitive e ignora nulos por padrão
  • Tratamento seguro: todas as exceções de (de)serialização lançam Jsoon.JsonSerializerException
  • API simples: apenas métodos estáticos, sem configuração
  • Compatível: .NET 8+

Exemplo completo

public class Pessoa
{
    public string Nome { get; set; } = string.Empty;
    public int Idade { get; set; }
}

var pessoa = new Pessoa { Nome = "Rodrigo", Idade = 30 };
string json = Jsoon.Serializer.Serialize(pessoa);
Pessoa? resultado = Jsoon.Serializer.Deserialize<Pessoa>(json);

Exceções

Todos os métodos públicos lançam apenas Jsoon.JsonSerializerException em caso de erro, facilitando o tratamento centralizado:

try
{
    var obj = Jsoon.Serializer.Deserialize<MyType>("json inválido");
}
catch (JsonSerializerException ex)
{
    // Trate erros de serialização aqui
}

Licença

MIT © Rodrigo


Veja o código fonte e contribua no GitHub

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

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.3 137 7/15/2025