Json.Net 1.0.16

A minimalistic JSON handler library.

Install-Package Json.Net -Version 1.0.16
dotnet add package Json.Net --version 1.0.16
<PackageReference Include="Json.Net" Version="1.0.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Json.Net --version 1.0.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Json.Net

A minimalistic JSON handler library.

Framework : .NET Standard 2.0

Usage instructions

Define a POCO class...

class Pet
{
  public int id;
  public string name;
}

Serialization...

var petJson = JsonNet.Serialize(pet);

Deserialization...

var pet = JsonNet.Deserialize<Pet>(petJson);

You can also define and use custom type converters to control serialization/deserialization.

var dateConverter = 
  new JsonConverter<DateTime>(
    dt => dt.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss", CultureInfo.InvariantCulture),
    s => DateTime.ParseExact(s, "yyyy'-'MM'-'dd'T'HH':'mm':'ss", CultureInfo.InvariantCulture));
  
var petJson = JsonNet.Serialize(pet, dateConverter);

Reference

Name space

using Json.Net;

Methods

string JsonNet.Serialize(object obj, params IJsonConverter[] converters)
Description

Serializes an object to its JSON text representation.

Parameters

obj : Object to be serialized
converters : Custom type converters. Default: empty


void Serialize(object obj, Stream stream, params IJsonConverter[] converters)
Description

Serializes an object to a JSON text stream destination.

Parameters

obj : Object to be serialized
stream : JSON stream
converters : Custom type converters. Default: empty


void Serialize(object obj, TextWriter writer, params IJsonConverter[] converters)
Description

Serializes an object to a JSON text writer destination.

Parameters

obj : Object to be serialized
writer : JSON text writer
converters : Custom type converters. Default: empty

T JsonNet.Deserialize<T>(string json, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text.

Parameters

T : Deserialized object's type
json : JSON text
converters : Custom converters. Default: empty


T Deserialize<T>(Stream stream, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text stream source.

Parameters

T : Deserialized object's type
stream : JSON stream
converters : Custom converters. Default: empty


T Deserialize<T>(TextReader reader, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text reader source.

Parameters

T : Deserialized object's type
reader : JSON text reader
converters : Custom converters. Default: empty


Converter interface

public interface IJsonConverter
{
  Type GetConvertingType();
  string Serializer(object obj);
  object Deserializer(string txt);
}

Json.Net

A minimalistic JSON handler library.

Framework : .NET Standard 2.0

Usage instructions

Define a POCO class...

class Pet
{
  public int id;
  public string name;
}

Serialization...

var petJson = JsonNet.Serialize(pet);

Deserialization...

var pet = JsonNet.Deserialize<Pet>(petJson);

You can also define and use custom type converters to control serialization/deserialization.

var dateConverter = 
  new JsonConverter<DateTime>(
    dt => dt.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss", CultureInfo.InvariantCulture),
    s => DateTime.ParseExact(s, "yyyy'-'MM'-'dd'T'HH':'mm':'ss", CultureInfo.InvariantCulture));
  
var petJson = JsonNet.Serialize(pet, dateConverter);

Reference

Name space

using Json.Net;

Methods

string JsonNet.Serialize(object obj, params IJsonConverter[] converters)
Description

Serializes an object to its JSON text representation.

Parameters

obj : Object to be serialized
converters : Custom type converters. Default: empty


void Serialize(object obj, Stream stream, params IJsonConverter[] converters)
Description

Serializes an object to a JSON text stream destination.

Parameters

obj : Object to be serialized
stream : JSON stream
converters : Custom type converters. Default: empty


void Serialize(object obj, TextWriter writer, params IJsonConverter[] converters)
Description

Serializes an object to a JSON text writer destination.

Parameters

obj : Object to be serialized
writer : JSON text writer
converters : Custom type converters. Default: empty

T JsonNet.Deserialize<T>(string json, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text.

Parameters

T : Deserialized object's type
json : JSON text
converters : Custom converters. Default: empty


T Deserialize<T>(Stream stream, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text stream source.

Parameters

T : Deserialized object's type
stream : JSON stream
converters : Custom converters. Default: empty


T Deserialize<T>(TextReader reader, params IJsonConverter[] converters)
Description

Deserializes an object from a JSON text reader source.

Parameters

T : Deserialized object's type
reader : JSON text reader
converters : Custom converters. Default: empty


Converter interface

public interface IJsonConverter
{
  Type GetConvertingType();
  string Serializer(object obj);
  object Deserializer(string txt);
}

Release Notes

Serialization performance tweaks.

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.16 92,297 1/5/2019
1.0.15 684 1/5/2019
1.0.14 306 1/5/2019
1.0.13 2,850 12/17/2018
1.0.12 299 12/17/2018
1.0.11 270 12/16/2018
1.0.10 628 12/15/2018
1.0.9 1,578 12/13/2018
1.0.8 209 12/13/2018
1.0.7 185 12/13/2018
1.0.6 317 12/12/2018
1.0.5 240 12/12/2018
1.0.4 182 12/12/2018
1.0.3 265 12/12/2018
1.0.1 307 12/12/2018
1.0.0 1,371 12/12/2018