Andeart.JsonButler 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Andeart.JsonButler --version 1.0.2                
NuGet\Install-Package Andeart.JsonButler -Version 1.0.2                
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="Andeart.JsonButler" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Andeart.JsonButler --version 1.0.2                
#r "nuget: Andeart.JsonButler, 1.0.2"                
#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.
// Install Andeart.JsonButler as a Cake Addin
#addin nuget:?package=Andeart.JsonButler&version=1.0.2

// Install Andeart.JsonButler as a Cake Tool
#tool nuget:?package=Andeart.JsonButler&version=1.0.2                

JsonButler

JsonButler is now available as a Visual Studio extension. Check it out here!


JsonButler lets you:

  • Generate C# types (along with the cs files if needed) from JSON data. Also generates nested custom types if needed.
  • Serialize a known C# type to JSON without having to instantiate an instance of said type. It drills down and uses default values as far as possible.

Code Generation

Example usage:

// JsonButler can parse json text-snippets directly...
string input = myJsonText;

// ...or can instead parse the contents of a file.
input = ButlerReader.ReadAllText (myJsonFilePath);

// Generates C# code (i.e. contents of potential C# file).
string generatedCsCode = ButlerCodeGenerator.GenerateCodeFile (input);

// JsonButler can either copy this text to the clipboard...
ButlerWriter.SetClipboardText (generatedCode);

// ...or write it to a file.
ButlerWriter.WriteAllText (outputFile, generatedCode);

Serialization

Example usage:

// Run JSONButler serialization with no customisation...
string serialized = ButlerSerializer.SerializeType<MyResponsePayload> ();

// ...or pass in specific serialization settings, such as limiting the scope of type generation, ...
ButlerSerializerSettings serializerSettings = new ButlerSerializerSettings (Assembly.GetExecutingAssembly ());

// ...setting constructor priorities for default object creation, ...
serializerSettings.PreferredAttributeTypesOnConstructor = new[] { typeof(MyConstructorAttribute), typeof(ClientsConstructorAttribute) };

// ... and customising the final JSON serialization.
serializerSettings.JsonSerializerSettings = myJsonSerializerSettings;

string serialized = ButlerSerializer.SerializeType<MyResponsePayload> (serializerSettings);
Product Compatible and additional computed target framework versions.
.NET Framework net471 is compatible.  net472 was computed.  net48 was computed.  net481 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.4 823 3/3/2019
1.0.3 592 2/26/2019
1.0.2 581 2/26/2019

Make minor internal updates; Update assembly naming