A fully object-oriented approach to JSON manipulation, validation, and serialization that focuses on modeling the JSON structure rather than mere string parsing and conversion.
Clone or download
Latest commit 978037b Sep 17, 2018
Failed to load latest commit information.
Json-Path-Test-Suite @ 8bf878e updated sub-repos Sep 24, 2017
Json-Schema-Test-Suite @ 002ce0f updated schema test suite Sep 10, 2018
Manatee.Json.Tests.Console all tests pass!!! Sep 10, 2018
Manatee.Json.Tests.FrameworkConsole all tests pass!!! Sep 10, 2018
Manatee.Json.Tests.Performance Feature/schema 06 (#72) Sep 14, 2017
Manatee.Json.Tests fixed output format for tests Sep 13, 2018
Manatee.Json fixed static construction Sep 16, 2018
Manatee.Study all tests pass!!! Sep 10, 2018
Resources added slack logos May 15, 2018
docs minor edit to docs Sep 16, 2018
docs_source updated readme Sep 17, 2018
json-patch-tests @ 99264bb Task/117 build server (#135) Jan 11, 2018
.gitignore migrated docs from wiki to a GH pages site May 18, 2018
.gitmodules updated docs site. it's better, believe me. Jun 2, 2018
ECMA-404.pdf Signed assemblies Sep 2, 2015
LICENSE.txt Feature/schema 06 (#72) Sep 14, 2017
Local.testsettings Signed assemblies Sep 2, 2015
Manatee.Json.sln Feature/issue 93 schema7 (#113) Dec 5, 2017
Manatee.Json.sln.DotSettings opened up string format for custom implementation Sep 16, 2018
Manatee.Json.suo Signed assemblies Sep 2, 2015
Manatee.Json.v11.suo Signed assemblies Sep 2, 2015
Manatee.Json.v12.suo Added JsonSchemaFactory.Load(string) to load a schema from a file. Jan 12, 2016
Performance results.txt Signed assemblies Sep 2, 2015
README.md updated readme Sep 17, 2018
RELEASE NOTES.md updated links to docs & release notes May 18, 2018
TraceAndTestImpact.testsettings Signed assemblies Sep 2, 2015
appveyor.yml updated build config Jul 9, 2018
build.bat added back some lines in myget build script Jan 11, 2018
nuget-restore.ps1 Feature/schema 06 (#72) Sep 14, 2017
schema04.json updated local & coded metas Jul 9, 2018
schema06.json updated local & coded metas Jul 9, 2018
schema07.json updated local & coded metas Jul 9, 2018



NuGet version (Manatee.Json) Build status MyGet Build Status Percentage of issues still open Average time to resolve an issue

Discuss on Slack


The primary goal of Manatee.Json is to make working with JSON simple and intuitive for the developer. This library recognizes that JSON is much more than just a mechanism for data transfer.

Secondarily, Manatee.Json is intended to be strictly compliant with RFC-8259, which means that it purposefully does not support JSON variants, like single-quoted strings or BSON.

Read from a file

var text = File.ReadAllText("content.json");
var json = JsonValue.Parse(text);

The json field now contains the content of the .json file. The object structure is exactly what you'd expect by looking at the file.

Object model

These JSON types map to primitive .Net types:

  • true/false as Boolean,
  • numbers as Double,
  • strings as String

These JSON types map to types defined in Manatee.Json:

  • objects ({"key":"value", "otherKey":9}) as JsonObject which derives from Dictionary<string, JsonValue>
  • arrays (["value", 9] as JsonArray which derives from List<JsonValue>

All of these types are encapsulated in a container type, JsonValue. This type exposes a property for each value type, as well as a property for which type the value contains.

For the JSON null there is a readonly static JsonValue.Null field.

Building JSON manually

Manatee.Json defines implicit conversions to JsonValue from Boolean, Double, String, JsonObject, and JsonArray. This helps greatly in building complex objects manually.

JsonValue str = "value",
          num = 10,
          boolean = false;

Because the collection types are derived from core .Net types, you also get all of the initialization capabilities.

var obj = new JsonObject
        ["key"] = "value",
        ["otherKey"] = 9
var array = new JsonArray { "value", 9, obj };


Converting .Net objects to and from JSON is also simple:

  1. Create a serializer

     var serializer = new JsonSerializer();
  2. De/Serialize

     var myObject = serializer.Deserialize<MyObject>(json);
     var backToJson = serializer.Serialize(myObject);

There are many ways to customize serialization. See the wiki page for more details!

But wait, there's more!

Manatee.Json also:

  • Is covered by over 2000 unit tests
  • Conforms to RFC-8259: The JSON specification
  • Supports:
    • .Net Framework 4.5
    • .Net Standard 1.3
    • .Net Standard 2.0
  • Outputs compact and prettified JSON text
  • Supports JSON Schema INCLUDED AND FREE!
    • Draft 4
    • Draft 6
    • Draft 7
    • Native object model
    • Customizable JSON Schema validation errors
    • User-defined keywords
  • Supports JSONPath
    • Native object model
    • Compile-time checking
  • Supports JsonPatch (with object model)
  • Supports JSON Pointer (with object model)
  • Is fully LINQ-compatible
  • Converts between JSON and XML
  • Reports parsing errors using JSON Pointer to identify location
  • Supports streamed parsing
  • Is fully open-source under the MIT license

Serialization features:

  • De/Serialize abstraction types (abstract classes and interfaces) by type registration
  • De/Serialize dynamic types
  • JIT type creation for unregistered abstraction types
  • De/Serialize anonymous types
  • Fully customizable serialization of both 1st- and 3rd-party types
  • De/Serialize static types/properties
  • De/Serialize fields
  • De/Serialize enumerations by name or numeric value
  • Maintain object references/graphs
  • De/Serialize circular references
  • Optionally include type names
  • Each serializer instance can be independently configured
  • Supports multiple date/time formats (ISO 8601, JavaScript, custom)
  • Supports using DI containers for object creation
  • Supports non-default constructors
  • Property name customization via attribute
  • Global property name transformations
  • Opt-out property inclusion via attribute
  • Optionally serialize only properties for requested type or all properties defined by object

See the docs for more information on how to use this wonderful library!


If you have questions, experience problems, or feature ideas, please create an issue.

If you'd like to help out with the code, please feel free to fork and create a pull request.

Special thanks

@sixlettervariables (Christopher Watford) for digging around the muck that was the serialization code and drastically improving performance.

The Project

This code uses C# 7 features, so a compiler/IDE that supports these features is required.

The library consists of a single project that target .Net Standard 1.3. The test project targets .Net Framework 4.6.


During development, building within Visual Studio should be fine.

Code style and maintenance

I use Jetbrains Resharper in Visual Studio to maintain the code style (and for many of the other things that it does). The solution is set up with team style settings, so if you're using Resharper the settings should automatically load. Please follow the suggestions.


If you've enjoyed using this library and you'd like to contribute financially, please use the button below.