# Class InvalidJsonException (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.InvalidJsonException)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.InvalidJsonException)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.InvalidJsonException)

    public sealed class InvalidJsonException : IOException, ISerializable

Thrown when an attempt is made to parse invalid JSON, e.g. using
a non-string property key, or including a redundant comma. Parsing a protocol buffer
message represented in JSON using [JsonParser](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser) can throw both this
exception and [InvalidProtocolBufferException](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.InvalidProtocolBufferException) depending on the situation. This
exception is only thrown for "pure JSON" errors, whereas `InvalidProtocolBufferException`
is thrown when the JSON may be valid in and of itself, but cannot be parsed as a protocol buffer
message.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [Exception](https://learn.microsoft.com/dotnet/api/system.exception) \> [SystemException](https://learn.microsoft.com/dotnet/api/system.systemexception) \> [IOException](https://learn.microsoft.com/dotnet/api/system.io.ioexception) \> InvalidJsonException

## Implements

[ISerializable](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.iserializable)

## Inherited Members

[Exception.GetBaseException()](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception) [Exception.GetObjectData(SerializationInfo, StreamingContext)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata) [Exception.GetType()](https://learn.microsoft.com/dotnet/api/system.exception.gettype) [Exception.ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring) [Exception.Data](https://learn.microsoft.com/dotnet/api/system.exception.data) [Exception.HelpLink](https://learn.microsoft.com/dotnet/api/system.exception.helplink) [Exception.HResult](https://learn.microsoft.com/dotnet/api/system.exception.hresult) [Exception.InnerException](https://learn.microsoft.com/dotnet/api/system.exception.innerexception) [Exception.Message](https://learn.microsoft.com/dotnet/api/system.exception.message) [Exception.Source](https://learn.microsoft.com/dotnet/api/system.exception.source) [Exception.StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace) [Exception.TargetSite](https://learn.microsoft.com/dotnet/api/system.exception.targetsite) [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.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

## Namespace

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

## Assembly

Google.Protobuf.dll