Generic JSON data that stores all unknown key name/value pairs.
Subclasses can declare fields for known data keys using the Key annotation. Each field
can be of any visibility (private, package private, protected, or public) and must not be static.
null unknown data key names are not allowed, but null data values are allowed.
Implementation is not thread-safe. For a thread-safe choice instead use an implementation of
ConcurrentMap.
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,
applications should use a single globally-shared instance of the JSON factory.
Beta
Declares that the data type enclosing this field is polymorphic, and that the value of this field
in a heterogeneous JSON schema will determine what type the data should be parsed into.
A data structure must have no more than one field with this annotation present. The annotated
field's type must be considered "primitive" by Data#isPrimitive(Type). The field's value
will be compared against the TypeDef#key() using Object#toString().
[[["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-09-04 UTC."],[],[],null,["# Package com.google.api.client.json (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.json)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.json)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.json)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.json)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.json)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.json)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.json)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.json) \nUtilities for JSON as specified in [RFC 4627: The\napplication/json Media Type for JavaScript Object Notation (JSON)](http://tools.ietf.org/html/rfc4627) and [Introducing JSON](http://json.org/).\n\nClasses\n-------\n\n### [CustomizeJsonParser](/java/docs/reference/google-http-client/latest/com.google.api.client.json.CustomizeJsonParser)\n\n[Beta](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta) \n\nCustomizes the behavior of a JSON parser.\n\nAll methods have a default trivial implementation, so subclasses need only implement the\nmethods whose behavior needs customization.\n\nImplementation has no fields and therefore thread-safe, but sub-classes are not necessarily\nthread-safe.\n\n### [GenericJson](/java/docs/reference/google-http-client/latest/com.google.api.client.json.GenericJson)\n\nGeneric JSON data that stores all unknown key name/value pairs.\n\nSubclasses can declare fields for known data keys using the [Key](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Key) annotation. Each field\ncan be of any visibility (private, package private, protected, or public) and must not be static.\n`null` unknown data key names are not allowed, but `null` data values are allowed.\n\nImplementation is not thread-safe. For a thread-safe choice instead use an implementation of\nConcurrentMap.\n\n### [Json](/java/docs/reference/google-http-client/latest/com.google.api.client.json.Json)\n\nJSON utilities.\n\n### [JsonFactory](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory)\n\nAbstract low-level JSON factory.\n\nImplementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency,\napplications should use a single globally-shared instance of the JSON factory.\n\n### [JsonGenerator](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonGenerator)\n\nAbstract low-level JSON serializer.\n\nImplementation has no fields and therefore thread-safe, but sub-classes are not necessarily\nthread-safe.\n\n### [JsonObjectParser](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonObjectParser)\n\nParses JSON data into an data class of key/value pairs.\n\nImplementation is thread-safe.\n\nSample usage: \n\n \n static void setParser(HttpRequest request) {\n request.setParser(new JsonObjectParser(new JacksonFactory()));\n }\n \n \n### [JsonObjectParser.Builder](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonObjectParser.Builder)\n\nBuilder.\n\nImplementation is not thread-safe.\n\n### [JsonParser](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonParser)\n\nAbstract low-level JSON parser. See \u003chttps://developers.google.com/api-client-library/java/google-http-java-client/json\u003e\n\nImplementation has no fields and therefore thread-safe, but sub-classes are not necessarily\nthread-safe.\n\nIf a JSON map is encountered while using a destination class of type Map, then an java.util.ArrayMap is used by default for the parsed values.\n\nEnums\n-----\n\n### [JsonToken](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonToken)\n\nJSON token in the low-level JSON library.\n\nAnnotation Types\n----------------\n\n### [JsonPolymorphicTypeMap](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonPolymorphicTypeMap)\n\n[Beta](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta) \n\nDeclares that the data type enclosing this field is polymorphic, and that the value of this field\nin a heterogeneous JSON schema will determine what type the data should be parsed into.\n\nA data structure must have no more than one field with this annotation present. The annotated\nfield's type must be considered \"primitive\" by [Data#isPrimitive(Type)](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Data#com_google_api_client_util_Data_isPrimitive_java_lang_reflect_Type_). The field's value\nwill be compared against the [TypeDef#key()](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonPolymorphicTypeMap.TypeDef#com_google_api_client_json_JsonPolymorphicTypeMap_TypeDef_key_) using [Object#toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--).\n\n### [JsonPolymorphicTypeMap.TypeDef](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonPolymorphicTypeMap.TypeDef)\n\nDeclares a mapping between a key value and a referenced class.\n\n### [JsonString](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonString)\n\nUse this annotation to specify that a declared numeric Java field should map to a JSON string.\n\nBy default declared Java numeric fields are stored as JSON numbers. For example: \n\n \n class A {\n @Key BigInteger value;\n }\n \n \ncan be used for this JSON content: \n\n \n {\"value\" : 12345768901234576890123457689012345768901234576890}\n \n \nHowever, if instead the JSON content uses a JSON String to store the value, one needs to use\nthe [JsonString](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonString) annotation. For example: \n\n \n class B {\n @Key @JsonString BigInteger value;\n }\n \n \ncan be used for this JSON content: \n\n \n {\"value\" : \"12345768901234576890123457689012345768901234576890\"}"]]