Soenneker.Extensions.JsonElements
4.0.76
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Extensions.JsonElements --version 4.0.76
NuGet\Install-Package Soenneker.Extensions.JsonElements -Version 4.0.76
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="Soenneker.Extensions.JsonElements" Version="4.0.76" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.JsonElements" Version="4.0.76" />
<PackageReference Include="Soenneker.Extensions.JsonElements" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Extensions.JsonElements --version 4.0.76
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Extensions.JsonElements, 4.0.76"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Extensions.JsonElements@4.0.76
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Extensions.JsonElements&version=4.0.76
#tool nuget:?package=Soenneker.Extensions.JsonElements&version=4.0.76
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Extensions.JsonElements
A collection of helpful JsonElement extension methods.
Installation
dotnet add package Soenneker.Extensions.JsonElements
Quick start
using Soenneker.Extensions.JsonElements;
// Given an existing JsonElement named element:
var result = element.IsNullOrUndefined();
Common operations
IsNullOrUndefined()- True if element is Null or Undefined.ToInt()- Fast int conversion. Supports JSON numbers and numeric strings. Throws on invalid input (keeps the "ToX" semantics).ToBool()- Fast bool conversion. Supports JSON booleans and "true"/"false" strings (case-insensitive). Throws on invalid input.ToGuid()- Fast Guid conversion. Supports JSON string GUIDs. Throws on invalid input.ToDateTime()- Fast DateTime conversion. Supports JSON string values (ISO 8601 preferred). Throws on invalid input.ToDateTimeOffset()- Fast DateTimeOffset conversion. Supports JSON string values (ISO 8601 preferred). Throws on invalid input.ToStr()- Returns a string view of the element with minimal work/allocations. - String: returns the JSON string value. - Number: uses TryGetInt64/TryGetDouble to avoid serializing the element. - True/False: returns "true"/"false". - Null/Undefined: returns "" (or change to null if you prefer). - Object/Array: returns raw JSON via GetRawText() (allocates a string, but avoids formatting).To()- Deserializes the element toTusing Web defaults. Note: this can be expensive because it deserializes from the element (often via raw text). Prefer explicit getters / TryGet methods for primitives.TryToInt()- Attempts to read the JSON value as anint; returnsfalseinstead of throwing when it is null or incompatible.TryToBool()- Attempts to read the JSON value as abool; returnsfalseinstead of throwing when it is null or incompatible.TryToGuid()- Attempts to read the JSON value as aGuid; returnsfalseinstead of throwing when it is null or malformed.JsonElementToObject()- Converts a JSON element to a corresponding .NET object representation. Returns a .NET object representing the JSON value. Returns a dictionary for JSON objects, a list for arrays, a string for string values, a numeric type for numbers, a Boolean for true or false, or null for null or undefined values.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Soenneker.Json.OptionsCollection (>= 4.0.1276)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Extensions.JsonElements:
| Package | Downloads |
|---|---|
|
Soenneker.Utils.Yaml
A utility library handling useful YAML functionalities |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.77 | 0 | 8/30/2026 |
| 4.0.76 | 0 | 8/29/2026 |
| 4.0.75 | 0 | 8/29/2026 |
| 4.0.74 | 2,724 | 8/21/2026 |
| 4.0.73 | 2,649 | 8/18/2026 |
| 4.0.72 | 92 | 8/18/2026 |
| 4.0.71 | 8,460 | 8/7/2026 |
| 4.0.70 | 3,294 | 7/28/2026 |
| 4.0.69 | 609 | 7/28/2026 |
| 4.0.68 | 108 | 7/27/2026 |
| 4.0.67 | 4,719 | 7/18/2026 |
| 4.0.66 | 100 | 7/18/2026 |
| 4.0.65 | 9,716 | 7/3/2026 |
| 4.0.64 | 2,667 | 6/20/2026 |
| 4.0.63 | 1,471 | 6/19/2026 |
| 4.0.62 | 622 | 6/18/2026 |
| 4.0.61 | 8,224 | 6/6/2026 |
| 4.0.60 | 595 | 6/5/2026 |
| 4.0.59 | 115 | 6/5/2026 |
| 4.0.58 | 7,212 | 5/2/2026 |
Loading failed
Improve XML documentation