Module org.autogui

Class JsonWriter

java.lang.Object
org.autogui.base.JsonWriter

public class JsonWriter extends Object
a simple JSON writer.
     String jsonSource = JsonWriter.create().write(obj).toSource();
 
  • Field Details

    • source

      protected Appendable source
    • level

      protected int level
    • newLines

      protected boolean newLines
  • Constructor Details

    • JsonWriter

      public JsonWriter(Appendable source)
    • JsonWriter

      public JsonWriter()
  • Method Details

    • write

      public static void write(Object json, File file)
    • write

      public static void write(Object json, Path file)
    • create

      public static JsonWriter create()
    • withNewLines

      public JsonWriter withNewLines(boolean newLines)
    • write

      public JsonWriter write(Object o)
    • writeObject

      protected void writeObject(Object o)
    • writeMap

      public JsonWriter writeMap(Map<?,?> m)
    • writeString

      public JsonWriter writeString(String s)
    • writeArray

      public JsonWriter writeArray(List<?> a)
    • writeNumber

      public JsonWriter writeNumber(Number n)
    • emit

      protected void emit(String str)
    • emit

      protected void emit(char c)
    • error

      protected void error(Exception ex)
    • emitIndentUp

      protected void emitIndentUp()
    • emitIndentDown

      protected void emitIndentDown()
    • emitIndentReturn

      protected void emitIndentReturn()
    • isEscape

      protected boolean isEscape(char c)
    • toEscape

      protected char toEscape(char c)
    • toSource

      public String toSource()