Send feedback
  
   
 
  
    
      Class MockJsonGenerator (2.0.2)
    
    
      
      
      Stay organized with collections
     
    
      
      Save and categorize content based on your preferences.
     
    
  
  
   
  
    
  
  
    
    
    
    
  Version latestkeyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   class  MockJsonGenerator   extends   JsonGenerator  
  
  
  
  Methods
   
  close() 
  
  Closes the serializer and the underlying output stream or writer, and releases any memory
 associated with it.
Overrides 
  
  
  flush() 
  
  Flushes any buffered content to the underlying output stream or writer.
Overrides 
  
  
  getFactory() 
  
    
public   JsonFactory   getFactory ()  
  Returns the JSON factory from which this generator was created.
Overrides 
  
  writeBoolean(boolean state) 
  
    
public   void   writeBoolean ( boolean   state )  
  Writes a literal JSON boolean value ('true' or 'false').
    
      
        Parameter  
      
        Name Description  
      
        stateboolean  
     
  
  Overrides 
  
  
  writeEndArray() 
  
    
public   void   writeEndArray ()  
  Writes a JSON end array character ']'.
Overrides 
  
  
  writeEndObject() 
  
    
public   void   writeEndObject ()  
  Writes a JSON end object character '}'.
Overrides 
  
  
  writeFieldName(String name) 
  
    
public   void   writeFieldName ( String   name )  
  Writes a JSON quoted field name.
    
      
        Parameter  
      
        Name Description  
      
        nameString  
     
  
  Overrides 
  
  
  writeNull() 
  
  Writes a literal JSON null value.
Overrides 
  
  
  writeNumber(double v) 
  
    
public   void   writeNumber ( double   v )  
  Writes a JSON double value.
    
      
        Parameter  
      
        Name Description  
      
        vdouble  
     
  
  Overrides 
  
  
  writeNumber(float v) 
  
    
public   void   writeNumber ( float   v )  
  Writes a JSON float value.
    
      
        Parameter  
      
        Name Description  
      
        vfloat  
     
  
  Overrides 
  
  
  writeNumber(int v) 
  
    
public   void   writeNumber ( int   v )  
  
  
    
      
        Parameter  
      
        Name Description  
      
        vint  
     
  
  Overrides 
  
  
  writeNumber(String encodedValue) 
  
    
public   void   writeNumber ( String   encodedValue )  
  Writes a JSON numeric value that has already been encoded properly.
    
      
        Parameter  
      
        Name Description  
      
        encodedValueString  
     
  
  Overrides 
  
  
  writeNumber(BigDecimal v) 
  
    
public   void   writeNumber ( BigDecimal   v )  
  Writes a JSON big decimal value.
Overrides 
  
  
  writeNumber(BigInteger v) 
  
    
public   void   writeNumber ( BigInteger   v )  
  Writes a JSON big integer value.
Overrides 
  
  
  writeNumber(long v) 
  
    
public   void   writeNumber ( long   v )  
  Writes a JSON long value.
    
      
        Parameter  
      
        Name Description  
      
        vlong  
     
  
  Overrides 
  
  
  writeStartArray() 
  
    
public   void   writeStartArray ()  
  Writes a JSON start array character '['.
Overrides 
  
  
  writeStartObject() 
  
    
public   void   writeStartObject ()  
  Writes a JSON start object character '{'.
Overrides 
  
  
  writeString(String value) 
  
    
public   void   writeString ( String   value )  
  Writes a JSON quoted string value.
    
      
        Parameter  
      
        Name Description  
      
        valueString  
     
  
  Overrides 
  
  
 
     
    
  
  
  
     
  
    
    
      
    
     
  
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-14 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["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-10-14 UTC."],[],[]]