Class JsonParser.Settings (3.15.8)

public sealed class Settings : object

Settings controlling JSON parsing.

Inheritance

Object > JsonParser.Settings

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Constructors

Settings(Int32)

public Settings(int recursionLimit)

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

Parameter
NameDescription
recursionLimitInt32

The maximum depth of messages to parse

Settings(Int32, TypeRegistry)

public Settings(int recursionLimit, TypeRegistry typeRegistry)

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

Parameters
NameDescription
recursionLimitInt32

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
JsonParser.Settings

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
Boolean

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
Int32

TypeRegistry

public TypeRegistry TypeRegistry { get; }

The type registry used to parse Any messages.

Property Value
TypeDescription
TypeRegistry

Methods

WithIgnoreUnknownFields(Boolean)

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
ignoreUnknownFieldsBoolean

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

Returns
TypeDescription
JsonParser.Settings

WithRecursionLimit(Int32)

public JsonParser.Settings WithRecursionLimit(int recursionLimit)

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

Parameter
NameDescription
recursionLimitInt32

The new recursion limit.

Returns
TypeDescription
JsonParser.Settings

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
JsonParser.Settings