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.
Type | Name | Description |
---|---|---|
Int32 | recursionLimit | 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.
Type | Name | Description |
---|---|---|
Int32 | recursionLimit | 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.
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
).
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.
Type | Description |
---|---|
Int32 |
TypeRegistry
public TypeRegistry TypeRegistry { get; }
The type registry used to parse Any messages.
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.
Type | Name | Description |
---|---|---|
Boolean | ignoreUnknownFields |
|
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.
Type | Name | Description |
---|---|---|
Int32 | recursionLimit | The new recursion limit. |
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.
Type | Name | Description |
---|---|---|
TypeRegistry | typeRegistry | The new type registry. Must not be null. |
Type | Description |
---|---|
JsonParser.Settings |