Class JSONWriter


  • public final class JSONWriter
    extends java.lang.Object
    A class which knows how to write JSON markup. All methods return this to enable chaining of method calls. Consider using the Jackson generator API instead, as that may be faster.
    Author:
    bratseth
    • Constructor Detail

      • JSONWriter

        public JSONWriter​(java.io.OutputStream stream)
    • Method Detail

      • beginField

        public JSONWriter beginField​(java.lang.String fieldName)
                              throws java.io.IOException
        Begins an object field
        Throws:
        java.io.IOException
      • endField

        public JSONWriter endField()
                            throws java.io.IOException
        Ends an object field
        Throws:
        java.io.IOException
      • beginArrayValue

        public JSONWriter beginArrayValue()
                                   throws java.io.IOException
        Begins an array value
        Throws:
        java.io.IOException
      • endArrayValue

        public JSONWriter endArrayValue()
                                 throws java.io.IOException
        Ends an array value
        Throws:
        java.io.IOException
      • beginObject

        public JSONWriter beginObject()
                               throws java.io.IOException
        Begin an object value
        Throws:
        java.io.IOException
      • endObject

        public JSONWriter endObject()
                             throws java.io.IOException
        End an object value
        Throws:
        java.io.IOException
      • beginArray

        public JSONWriter beginArray()
                              throws java.io.IOException
        Begin an array value
        Throws:
        java.io.IOException
      • endArray

        public JSONWriter endArray()
                            throws java.io.IOException
        End an array value
        Throws:
        java.io.IOException
      • value

        public JSONWriter value​(java.lang.String value)
                         throws java.io.IOException
        Writes a string value
        Throws:
        java.io.IOException
      • value

        public JSONWriter value​(java.lang.Number value)
                         throws java.io.IOException
        Writes a numeric value
        Throws:
        java.io.IOException
      • value

        public JSONWriter value​(boolean value)
                         throws java.io.IOException
        Writes a boolean value
        Throws:
        java.io.IOException
      • value

        public JSONWriter value()
                         throws java.io.IOException
        Writes a null value
        Throws:
        java.io.IOException