Skip to content

SimonCropp/Argon

Repository files navigation

Argon

Build status NuGet Status NuGet Status NuGet Status NuGet Status NuGet Status

Argon is a JSON framework for .NET. It is a hard fork of Newtonsoft.Json.

See Milestones for release notes.

Serialize JSON

var product = new Product
{
    Name = "Apple",
    Expiry = new(2008, 12, 28),
    Sizes = ["Small"]
};

var json = JsonConvert.SerializeObject(product);
// {
//   "Name": "Apple",
//   "Expiry": "2008-12-28T00:00:00",
//   "Sizes": [
//     "Small"
//   ]
// }

snippet source | anchor

Deserialize JSON

var json = """
    {
      'Name': 'Bad Boys',
      'ReleaseDate': '1995-4-7T00:00:00',
      'Genres': [
        'Action',
        'Comedy'
      ]
    }
    """;

var movie = JsonConvert.DeserializeObject<Movie>(json);

var name = movie.Name;
// Bad Boys

snippet source | anchor

LINQ to JSON

var jArray = new JArray
{
    "Manual text",
    new DateTime(2000, 5, 23)
};

var jObject = new JObject
{
    ["MyArray"] = jArray
};

var json = jObject.ToString();
// {
//   "MyArray": [
//     "Manual text",
//     "2000-05-23T00:00:00"
//   ]
// }

snippet source | anchor

Icon

Helmet designed by Juan Manuel Corredor from The Noun Project.

About

Argon is a JSON framework for .NET. It is a hard fork of Newtonsoft.Json.

Topics

Resources

License

Stars

Watchers

Forks