Testing.Dynamic.Json 1.0.0-rc3

.NET 5.0 .NET Standard 2.0
This is a prerelease version of Testing.Dynamic.Json.
dotnet add package Testing.Dynamic.Json --version 1.0.0-rc3
NuGet\Install-Package Testing.Dynamic.Json -Version 1.0.0-rc3
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="Testing.Dynamic.Json" Version="1.0.0-rc3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Testing.Dynamic.Json --version 1.0.0-rc3
#r "nuget: Testing.Dynamic.Json, 1.0.0-rc3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Testing.Dynamic.Json as a Cake Addin
#addin nuget:?package=Testing.Dynamic.Json&version=1.0.0-rc3&prerelease

// Install Testing.Dynamic.Json as a Cake Tool
#tool nuget:?package=Testing.Dynamic.Json&version=1.0.0-rc3&prerelease

Testing.Dynamic.Json

Provides dynamicly access to property/member of Json object deserialized by System.Text.Json. This library is used for unit testing purpose only. It is not designated for production usage.

Nuget package

NuGet

Build Status

Build Status

Getting started

To support testing with dynamic json, first install the NuGet package:

Install-Package Testing.Dynamic.Json

Example dynamic json

  • Newtonsoft Json support
const string json = "[ 123, \"abc\", { \"iss\": \"Sso Issuer\", \"iat\": 1607746395 }]";

var jToken = Newtonsoft.Json.Linq.JToken.Parse(json);
Assert.Equal(3, (jToken as JArray).Count);
Assert.Equal(123, jToken[0]);
Assert.Equal(123L, jToken[0]);
Assert.Equal("abc", jToken[1]);
var jwtPayload = jToken[2];
Assert.Equal("Sso Issuer", jwtPayload["iss"]);
Assert.Equal(1607746395, jwtPayload["iat"]);
  • Testing.Dynamic.Json support
var djson = System.Text.Json.JsonSerializer.Deserialize<DJson>(json);
Assert.Equal(3, djson.CountMembers);
Assert.Equal(123, (int)(long)djson[0]);
Assert.Equal(123L, djson[0]);
Assert.Equal("abc", djson[1]);
var jwtPayload = (DJson)djson[2];
Assert.Equal("Sso Issuer", jwtPayload["iss"]);
Assert.Equal(1607746395L, jwtPayload["iat"]);
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

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.0-rc3 78 9/16/2022
1.0.0-rc2 35,796 10/18/2021
1.0.0-rc1 70,443 9/17/2021
1.0.0-preview2 72,969 12/12/2020
1.0.0-beta.2 195 12/17/2020
1.0.0-beta.1 183 12/13/2020