Class JsonParser.Settings (3.27.1)

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
Name Description
recursionLimit int

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
Name Description
recursionLimit int

The maximum depth of messages to parse

typeRegistry TypeRegistry

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
Type Description
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
Type Description
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
Type Description
int

TypeRegistry

public TypeRegistry TypeRegistry { get; }

The type registry used to parse Any messages.

Property Value
Type Description
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
Name Description
ignoreUnknownFields bool

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

Returns
Type Description
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
Name Description
recursionLimit int

The new recursion limit.

Returns
Type Description
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
Name Description
typeRegistry TypeRegistry

The new type registry. Must not be null.

Returns
Type Description
JsonParserSettings