vertical-jsonwriter-core 1.0.1

Prefix Reserved
dotnet add package vertical-jsonwriter-core --version 1.0.1                
NuGet\Install-Package vertical-jsonwriter-core -Version 1.0.1                
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="vertical-jsonwriter-core" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add vertical-jsonwriter-core --version 1.0.1                
#r "nuget: vertical-jsonwriter-core, 1.0.1"                
#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.
// Install vertical-jsonwriter-core as a Cake Addin
#addin nuget:?package=vertical-jsonwriter-core&version=1.0.1

// Install vertical-jsonwriter-core as a Cake Tool
#tool nuget:?package=vertical-jsonwriter-core&version=1.0.1                

vertical-jsonwriter-core

Provides an abstraction over System.Text.Json.Utf8JsonReader that handles the structural state of JSON document parsing.

Overview

Simply put, the JsonStructureReader class accepts a Utf8JsonReader structure, and forwards node information to a visitor implementation. The node information contains the current depth, parent type, applicable values, property names, etc.

Quick Start

Add a package reference to your .csproj file:

$ dotnet add package vertical-jsonwriter-core 

Usage

Define an implementation of IJsonStructureVisitor:

public class MyJsonStructureVisitor : IJsonStructureVisitor
{
    // Implement methods...

    void VisitObjectStart(in JsonVisitingState state) { /* Implementation */ }    
    void VisitObjectEnd(in JsonVisitingState state, int childCount) { /* Implementation */ }    
    void VisitArrayStart(in JsonVisitingState state) { /* Implementation */ }    
    void VisitArrayEnd(in JsonVisitingState state, int childCount) { /* Implementation */ }
    void VisitPropertyName(in JsonVisitingState state, string name) { /* Implementation */ }
    void VisitStringValue(in JsonVisitingState state, string value) { /* Implementation */ }
    void VisitInt32Value(in JsonVisitingState state, int value) { /* Implementation */ }
    void VisitInt64Value(in JsonVisitingState state, long value) { /* Implementation */ }
    void VisitDoubleValue(in JsonVisitingState state, double value) { /* Implementation */ }
    void VisitDecimalValue(in JsonVisitingState state, decimal value) { /* Implementation */ }
    void VisitBooleanValue(in JsonVisitingState state, bool value) { /* Implementation */ }
    void VisitNull(in JsonVisitingState state) { /* Implementation */ }    
}

The JsonVisitingState structure contains information regarding the location of the reader that may be of interest:

Property Description
Depth The current depth level of the reader. Any time the reader descends into an object or array, the depth is incremented.
Index The ordinal index of the node within its parent object or array. This property is zero-based.
JsonPlacement One of JsonPlacement values that describe the location of the current node.

The JsonPlacement enum describes the placement of the current node, relative to its parent:

Value Description
RootDocument The node is a child of the top-most array or object.
Object The node is a child of a JSON object.
Array The node is a child of a JSON array.
Property The node is the literal value of a property in a JSON object, or a value in a JSON array.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.1 207 4/22/2023
1.0.0 181 4/22/2023