Table of Contents

Class JsonParser<TContract>

Namespace
DotBahn.Common.Parsing
Assembly
DotBahn.Common.dll

Generic JSON parser implementation using source-generated metadata

public class JsonParser<TContract> : IParser<TContract> where TContract : new()

Type Parameters

TContract

The raw type to deserialize into

Inheritance
JsonParser<TContract>
Implements
IParser<TContract>
Inherited Members

Constructors

JsonParser(JsonTypeInfo<TContract>)

Generic JSON parser implementation using source-generated metadata

public JsonParser(JsonTypeInfo<TContract> type)

Parameters

type JsonTypeInfo<TContract>

The source-generated JSON type info for TContract

Methods

Parse(string)

Parses the provided input string into the target type

public TContract Parse(string input)

Parameters

input string

The input data (e.g., XML, JSON)

Returns

TContract

The parsed object

Exceptions

JsonException

Thrown when deserialization fails or returns null