Show / Hide Table of Contents

Class JsonParser.Settings

Settings controlling JSON parsing.

Inheritance
System.Object
JsonParser.Settings
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Protobuf
Assembly: Google.Protobuf.dll
Syntax
public sealed class Settings

Constructors

Settings(Int32)

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

Declaration
public Settings(int recursionLimit)
Parameters
Type Name Description
System.Int32 recursionLimit

The maximum depth of messages to parse

Settings(Int32, TypeRegistry)

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

Declaration
public Settings(int recursionLimit, TypeRegistry typeRegistry)
Parameters
Type Name Description
System.Int32 recursionLimit

The maximum depth of messages to parse

TypeRegistry typeRegistry

The type registry used to parse Any messages

Properties

Default

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

Declaration
public static JsonParser.Settings Default { get; }
Property Value
Type Description
JsonParser.Settings

IgnoreUnknownFields

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

Declaration
public bool IgnoreUnknownFields { get; }
Property Value
Type Description
System.Boolean

RecursionLimit

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.

Declaration
public int RecursionLimit { get; }
Property Value
Type Description
System.Int32

TypeRegistry

The type registry used to parse Any messages.

Declaration
public TypeRegistry TypeRegistry { get; }
Property Value
Type Description
TypeRegistry

Methods

WithIgnoreUnknownFields(Boolean)

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

Declaration
public JsonParser.Settings WithIgnoreUnknownFields(bool ignoreUnknownFields)
Parameters
Type Name Description
System.Boolean ignoreUnknownFields

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

Returns
Type Description
JsonParser.Settings

WithRecursionLimit(Int32)

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

Declaration
public JsonParser.Settings WithRecursionLimit(int recursionLimit)
Parameters
Type Name Description
System.Int32 recursionLimit

The new recursion limit.

Returns
Type Description
JsonParser.Settings

WithTypeRegistry(TypeRegistry)

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

Declaration
public JsonParser.Settings WithTypeRegistry(TypeRegistry typeRegistry)
Parameters
Type Name Description
TypeRegistry typeRegistry

The new type registry. Must not be null.

Returns
Type Description
JsonParser.Settings
Back to top