Provides a simple object model for JSON, a parser, a printer, and visitors.
Note: The history of this assembly goes all the way back 2009, before
Newtonsoft.Jsonbecame the de facto standard for JSON serialization on .NET. It also predates the
System.Text.Jsonlibrary in the BCL.
The heart of the JSON library is an object model around JSON expressions, with
Expression being the base class. The type also provides factories for the following:
ConstantExpression Null()- A JSON constant expression representing
ConstantExpression Boolean(bool)- A JSON constant expression representing
ConstantExpression String(string)- A JSON constant expression representing a string literal, e.g.
ConstantExpression Number(string)- A JSON constant expression representing a numeric value, e.g.
ArrayExpression Array(IEnumerable<Expression>)- A JSON array expression with the given child nodes (supporting various overloads).
ObjectExpression Object(IDictionary<string, Expression>)- A JSON object expression with the given members.
Expression class also provides support to parse JSON using a
Parse(string) method, and a way to print JSON using a
ExpressionVisitor base class can be used to visit the nodes of a JSON expression. An
ExpressionVisitor<T> variant exists that can be used to convert a JSON expression to another object model.
Note: Visitors are used by other parts of Nuqleon to traverse a JSON expression.
This namespace provides rudimentary support to JSON serialization and deserialization for .NET objects, including support for:
- Primitive types such as
- Array types with a single dimension, as well as
- Objects either by implementing
IDictionary<string, object>or by reflection over properties or fields.
Note: This implementation is legacy (going back to 2009) but has been retained for compatibility in certain parts of the Nuqleon stack and services built on top. More flexible and performant options for serialization exist, either in the
System.Text.Json. New code should consider to use any of these.