Class JSWriter


public class JSWriter extends Object
A low level streaming JSON writer - assumes correct sequence of calls (e.g. keys in objects). Useful when writing JSON directly from some other structure
  • Field Details

  • Constructor Details

    • JSWriter

      public JSWriter()
    • JSWriter

      public JSWriter(OutputStream ps)
    • JSWriter

      public JSWriter( ps)
  • Method Details

    • startOutput

      public void startOutput()
    • finishOutput

      public void finishOutput()
    • startObject

      public JSWriter startObject()
    • finishObject

      public JSWriter finishObject()
    • key

      public JSWriter key(String key)
    • pair

      public JSWriter pair(String key, String value)
    • pair

      public JSWriter pair(String key, boolean val)
    • pair

      public JSWriter pair(String key, long val)
    • pair

      public JSWriter pair(String key, Number val)
    • startArray

      public JSWriter startArray()
    • finishArray

      public JSWriter finishArray()
    • arrayElement

      public JSWriter arrayElement(String str)
    • arrayElement

      public JSWriter arrayElement(boolean b)
    • arrayElement

      public JSWriter arrayElement(long integer)
    • arraySep

      public JSWriter arraySep()
      Useful if you are manually creating arrays and so need to print array separators yourself
    • outputQuotedString

      public static String outputQuotedString(String string)
    • outputQuotedString

      public static void outputQuotedString( out, String string)
    • outputQuotedString

      public static void outputQuotedString( out, String string, boolean allowBareWords)