class
PrettyJsonWriter extends JsonWriter
Instance Constructors
-
new
PrettyJsonWriter(output: Writer, indentation: Int = 2, leftMargin: Int = 0, targetWidth: Int = 78)
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
write(jobject: JValue): Unit
-
def
writeArray(elements: Seq[JValue]): Unit
-
def
writeBoolean(b: Boolean): Unit
-
def
writeNull(): Unit
-
def
writeNumber(x: BigDecimal): Unit
-
def
writeObject(fields: Map[String, JValue]): Unit
-
def
writeString(s: String): Unit
Inherited from AnyRef
Inherited from Any
An object that will write com.rojoma.json.ast.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:
Similarly for objects:
In the "indented" mode, the delimiters appear on lines by themselves, with each element formatted on a separate line:
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 aBufferedWriter
.