[[["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-28 UTC."],[],[],null,["# Class MockJsonFactory (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.testing.json.MockJsonFactory)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.testing.json.MockJsonFactory)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.testing.json.MockJsonFactory)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.testing.json.MockJsonFactory)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.testing.json.MockJsonFactory)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.testing.json.MockJsonFactory)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.testing.json.MockJsonFactory)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.testing.json.MockJsonFactory) \n\n public class MockJsonFactory extends JsonFactory\n\n[Beta](/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta) \n\nMock for [JsonFactory](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory).\n\nImplementation is thread-safe. \n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e [JsonFactory](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory) \\\u003e MockJsonFactory \n\nInherited Members\n-----------------\n\n[JsonFactory.\\\u003cT\\\u003efromInputStream(InputStream,Class\\\u003cT\\\u003e)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory__T_fromInputStream_java_io_InputStream_java_lang_Class_T__) \n[JsonFactory.\\\u003cT\\\u003efromInputStream(InputStream,Charset,Class\\\u003cT\\\u003e)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory__T_fromInputStream_java_io_InputStream_java_nio_charset_Charset_java_lang_Class_T__) \n[JsonFactory.\\\u003cT\\\u003efromReader(Reader,Class\\\u003cT\\\u003e)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory__T_fromReader_java_io_Reader_java_lang_Class_T__) \n[JsonFactory.\\\u003cT\\\u003efromString(String,Class\\\u003cT\\\u003e)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory__T_fromString_java_lang_String_java_lang_Class_T__) \n[JsonFactory.createJsonGenerator(OutputStream,Charset)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonGenerator_java_io_OutputStream_java_nio_charset_Charset_) \n[JsonFactory.createJsonGenerator(Writer)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonGenerator_java_io_Writer_) \n[JsonFactory.createJsonObjectParser()](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonObjectParser__) \n[JsonFactory.createJsonParser(InputStream)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_InputStream_) \n[JsonFactory.createJsonParser(InputStream,Charset)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_InputStream_java_nio_charset_Charset_) \n[JsonFactory.createJsonParser(Reader)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_Reader_) \n[JsonFactory.createJsonParser(String)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_lang_String_) \n[JsonFactory.toByteArray(Object)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_toByteArray_java_lang_Object_) \n[JsonFactory.toPrettyString(Object)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_toPrettyString_java_lang_Object_) \n[JsonFactory.toString(Object)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_toString_java_lang_Object_) \n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### MockJsonFactory()\n\n public MockJsonFactory()\n\nMethods\n-------\n\n### createJsonGenerator(OutputStream out, Charset enc)\n\n public JsonGenerator createJsonGenerator(OutputStream out, Charset enc)\n\nReturns a new instance of a low-level JSON serializer for the given output stream and encoding.\n\n**Overrides** \n[JsonFactory.createJsonGenerator(OutputStream out, Charset enc)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonGenerator_java_io_OutputStream_java_nio_charset_Charset_)\n\n### createJsonGenerator(Writer writer)\n\n public JsonGenerator createJsonGenerator(Writer writer)\n\nReturns a new instance of a low-level JSON serializer for the given writer.\n\n**Overrides** \n[JsonFactory.createJsonGenerator(Writer writer)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonGenerator_java_io_Writer_)\n\n### createJsonParser(InputStream in)\n\n public JsonParser createJsonParser(InputStream in)\n\nReturns a new instance of a low-level JSON parser for the given input stream. The parser tries\nto detect the charset of the input stream by itself.\n\n**Overrides** \n[JsonFactory.createJsonParser(InputStream in)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_InputStream_)\n\n### createJsonParser(InputStream in, Charset charset)\n\n public JsonParser createJsonParser(InputStream in, Charset charset)\n\nReturns a new instance of a low-level JSON parser for the given input stream.\n\n**Overrides** \n[JsonFactory.createJsonParser(InputStream in, Charset charset)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_InputStream_java_nio_charset_Charset_)\n\n### createJsonParser(Reader reader)\n\n public JsonParser createJsonParser(Reader reader)\n\nReturns a new instance of a low-level JSON parser for the given reader.\n\n**Overrides** \n[JsonFactory.createJsonParser(Reader reader)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_io_Reader_)\n\n### createJsonParser(String value)\n\n public JsonParser createJsonParser(String value)\n\nReturns a new instance of a low-level JSON parser for the given string value.\n\n**Overrides** \n[JsonFactory.createJsonParser(String value)](/java/docs/reference/google-http-client/latest/com.google.api.client.json.JsonFactory#com_google_api_client_json_JsonFactory_createJsonParser_java_lang_String_)"]]