# Class JsonParser.Settings (3.27.1)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.27.1 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.JsonParser.Settings)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.JsonParser.Settings)

    public sealed class JsonParser.Settings

Settings controlling JSON parsing.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> JsonParser.Settings

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Protobuf](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf)

## Assembly

Google.Protobuf.dll

## Constructors

### Settings(int)

    public Settings(int recursionLimit)

Creates a new [JsonParser.Settings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings) object with the specified recursion limit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `recursionLimit` | `https://learn.microsoft.com/dotnet/api/system.int32` The maximum depth of messages to parse |

### Settings(int, TypeRegistry)

    public Settings(int recursionLimit, TypeRegistry typeRegistry)

Creates a new [JsonParser.Settings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings) object with the specified recursion limit and type registry.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `recursionLimit` | `https://learn.microsoft.com/dotnet/api/system.int32` The maximum depth of messages to parse |
| `typeRegistry` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` The type registry used to parse [Any](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Any) messages |

## Properties

### Default

    public static JsonParser.Settings Default { get; }

Default settings, as used by [Default](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser#Google_Protobuf_JsonParser_Default). This has the same default
recursion limit as [CodedInputStream](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.CodedInputStream), and an empty type registry.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParserhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.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** |
| `https://learn.microsoft.com/dotnet/api/system.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** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### TypeRegistry

    public TypeRegistry TypeRegistry { get; }

The type registry used to parse [Any](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Any) messages.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` |   |

## Methods

### WithIgnoreUnknownFields(bool)

    public JsonParser.Settings WithIgnoreUnknownFields(bool ignoreUnknownFields)

Creates a new [JsonParser.Settings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings) object set to either ignore unknown fields, or throw an exception
when unknown fields are encountered.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ignoreUnknownFields` | `https://learn.microsoft.com/dotnet/api/system.boolean` `true` if unknown fields should be ignored when parsing; `false` to throw an exception. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParserhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings` |   |

### WithRecursionLimit(int)

    public JsonParser.Settings WithRecursionLimit(int recursionLimit)

Creates a new [JsonParser.Settings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings) object based on this one, but with the specified recursion limit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `recursionLimit` | `https://learn.microsoft.com/dotnet/api/system.int32` The new recursion limit. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParserhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings` |   |

### WithTypeRegistry(TypeRegistry)

    public JsonParser.Settings WithTypeRegistry(TypeRegistry typeRegistry)

Creates a new [JsonParser.Settings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings) object based on this one, but with the specified type registry.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `typeRegistry` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.TypeRegistry` The new type registry. Must not be null. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParserhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser.Settings` |   |