Class JsonParser.Settings (3.23.0)

public sealed class JsonParser.Settings

Settings controlling JSON parsing.

Inheritance

object > JsonParser.Settings

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Constructors

Settings(int)

public Settings(int recursionLimit)

Creates a new JsonParser.Settings object with the specified recursion limit.

Parameter
NameDescription
recursionLimitint

The maximum depth of messages to parse

Settings(int, TypeRegistry)

public Settings(int recursionLimit, TypeRegistry typeRegistry)

Creates a new JsonParser.Settings object with the specified recursion limit and type registry.

Parameters
NameDescription
recursionLimitint

The maximum depth of messages to parse

typeRegistryTypeRegistry

The type registry used to parse Any messages

Properties

Default

public static JsonParser.Settings Default { get; }

Default settings, as used by Default. This has the same default recursion limit as CodedInputStream, and an empty type registry.

Property Value
TypeDescription
JsonParserSettings

IgnoreUnknownFields

public bool IgnoreUnknownFields { get; }

Whether the parser should ignore unknown fields (true) or throw an exception when they are encountered (false).

Property Value
TypeDescription
bool

RecursionLimit

public int RecursionLimit { get; }

The maximum depth of messages to parse. Note that this limit only applies to parsing messages, not collections - so a message within a collection within a message only counts as depth 2, not 3.

Property Value
TypeDescription
int

TypeRegistry

public TypeRegistry TypeRegistry { get; }

The type registry used to parse Any messages.

Property Value
TypeDescription
TypeRegistry

Methods

WithIgnoreUnknownFields(bool)

public JsonParser.Settings WithIgnoreUnknownFields(bool ignoreUnknownFields)

Creates a new JsonParser.Settings object set to either ignore unknown fields, or throw an exception when unknown fields are encountered.

Parameter
NameDescription
ignoreUnknownFieldsbool

true if unknown fields should be ignored when parsing; false to throw an exception.

Returns
TypeDescription
JsonParserSettings

WithRecursionLimit(int)

public JsonParser.Settings WithRecursionLimit(int recursionLimit)

Creates a new JsonParser.Settings object based on this one, but with the specified recursion limit.

Parameter
NameDescription
recursionLimitint

The new recursion limit.

Returns
TypeDescription
JsonParserSettings

WithTypeRegistry(TypeRegistry)

public JsonParser.Settings WithTypeRegistry(TypeRegistry typeRegistry)

Creates a new JsonParser.Settings object based on this one, but with the specified type registry.

Parameter
NameDescription
typeRegistryTypeRegistry

The new type registry. Must not be null.

Returns
TypeDescription
JsonParserSettings