com.rojoma.json.io

PrettyJsonWriter

class PrettyJsonWriter extends JsonWriter

An object that will write JValues in a human-friendly indented format with no spaces or newlines.

The writer will try to keep as much data on a single line as possible. As a result, arrays and objects have two printing modes (selected automatically), "compact" and "indented".

In the "compact" mode, an array is stored on a single line:

   [ elem1, elem2, ... ]

Similarly for objects:

   { "key1" : value1, "key2 : value2, ... }

In the "indented" mode, the delimiters appear on lines by themselves, with each element formatted on a separate line:

   [
     elem1,
     elem2,
     ...
   ]

For objects, if a key/value pair does not fit on a single line, the value is printed on a line of its own, indented further:

   {
     "key" :
       value
   }

Empty arrays and objects are always represented compactly, as [] or {} respectively.

This does many small writes, so it is probably a good idea to wrap the Writer in a BufferedWriter.

Linear Supertypes
JsonWriter, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. PrettyJsonWriter
  2. JsonWriter
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PrettyJsonWriter (output: Writer, indentation: Int = 2, leftMargin: Int = 0, targetWidth: Int = 78)

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  9. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  12. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  13. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  14. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  15. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  16. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  17. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  18. def toString (): String

    Definition Classes
    AnyRef → Any
  19. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  20. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def write (jobject: JValue): Unit

    Write one JValue.

    Write one JValue.

    Definition Classes
    JsonWriter
    Annotations
    @throws( classOf[java.io.IOException] )
  23. def writeArray (elements: Seq[JValue]): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter
  24. def writeBoolean (b: Boolean): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter
  25. def writeNull (): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter
  26. def writeNumber (x: BigDecimal): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter
  27. def writeObject (fields: Map[String, JValue]): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter
  28. def writeString (s: String): Unit

    Attributes
    protected
    Definition Classes
    PrettyJsonWriterJsonWriter

Inherited from JsonWriter

Inherited from AnyRef

Inherited from Any