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 can throw both this
exception and 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eInvalidJsonException\u003c/code\u003e is thrown when parsing invalid JSON, such as non-string property keys or redundant commas.\u003c/p\u003e\n"],["\u003cp\u003eThis exception is distinct from \u003ccode\u003eInvalidProtocolBufferException\u003c/code\u003e, as it specifically addresses errors in pure JSON formatting, while the latter relates to issues with JSON data not conforming to protocol buffer message structures.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eInvalidJsonException\u003c/code\u003e inherits from \u003ccode\u003eIOException\u003c/code\u003e, \u003ccode\u003eSystemException\u003c/code\u003e, \u003ccode\u003eException\u003c/code\u003e, and \u003ccode\u003eobject\u003c/code\u003e, and implements \u003ccode\u003eISerializable\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class is part of the \u003ccode\u003eGoogle.Protobuf\u003c/code\u003e namespace and is found within the \u003ccode\u003eGoogle.Protobuf.dll\u003c/code\u003e assembly.\u003c/p\u003e\n"],["\u003cp\u003eThe most recent version of this class is version 3.27.1, however versions 3.23.0 and 3.15.8 also exist.\u003c/p\u003e\n"]]],[],null,["# Class InvalidJsonException (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.InvalidJsonException)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.InvalidJsonException)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.InvalidJsonException) \n\n public sealed class InvalidJsonException : IOException, ISerializable\n\nThrown when an attempt is made to parse invalid JSON, e.g. using\na non-string property key, or including a redundant comma. Parsing a protocol buffer\nmessage represented in JSON using [JsonParser](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.JsonParser) can throw both this\nexception and [InvalidProtocolBufferException](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.InvalidProtocolBufferException) depending on the situation. This\nexception is only thrown for \"pure JSON\" errors, whereas `InvalidProtocolBufferException`\nis thrown when the JSON may be valid in and of itself, but cannot be parsed as a protocol buffer\nmessage. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [Exception](https://learn.microsoft.com/dotnet/api/system.exception) \\\u003e [SystemException](https://learn.microsoft.com/dotnet/api/system.systemexception) \\\u003e [IOException](https://learn.microsoft.com/dotnet/api/system.io.ioexception) \\\u003e InvalidJsonException \n\nImplements\n----------\n\n[ISerializable](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.iserializable) \n\nInherited Members\n-----------------\n\n[Exception.GetBaseException()](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception) \n[Exception.GetObjectData(SerializationInfo, StreamingContext)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata) \n[Exception.GetType()](https://learn.microsoft.com/dotnet/api/system.exception.gettype) \n[Exception.ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring) \n[Exception.Data](https://learn.microsoft.com/dotnet/api/system.exception.data) \n[Exception.HelpLink](https://learn.microsoft.com/dotnet/api/system.exception.helplink) \n[Exception.HResult](https://learn.microsoft.com/dotnet/api/system.exception.hresult) \n[Exception.InnerException](https://learn.microsoft.com/dotnet/api/system.exception.innerexception) \n[Exception.Message](https://learn.microsoft.com/dotnet/api/system.exception.message) \n[Exception.Source](https://learn.microsoft.com/dotnet/api/system.exception.source) \n[Exception.StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace) \n[Exception.TargetSite](https://learn.microsoft.com/dotnet/api/system.exception.targetsite) \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Protobuf](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf)\n\nAssembly\n--------\n\nGoogle.Protobuf.dll"]]