public sealed class Settings : object
Settings controlling JSON parsing.
Namespace
Google.ProtobufAssembly
Google.Protobuf.dll
Constructors
Settings(Int32)
public Settings(int recursionLimit)
Creates a new JsonParser.Settings object with the specified recursion limit.
Parameter | |
---|---|
Name | Description |
recursionLimit | Int32 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 | |
---|---|
Name | Description |
recursionLimit | Int32 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 |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
Int32 |
TypeRegistry
public TypeRegistry TypeRegistry { get; }
The type registry used to parse Any messages.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
ignoreUnknownFields | Boolean
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
recursionLimit | Int32 The new recursion limit. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
typeRegistry | TypeRegistry The new type registry. Must not be null. |
Returns | |
---|---|
Type | Description |
JsonParser.Settings |