Util.Json
case JArray(Vector[Json])case JBool(Bool)case JNullcase JNumber(BigDecimal)case JObject(Map[String, Json])case JString(String)Represents a JSON value.
JSON numbers are stored as BigDecimal for lossless round-trip;
JSON objects are stored as Map[String, Json], which gives
canonical (sorted) key order on output.
Definitions
Parses s as a JSON value and decodes it as a via FromJson[a].
Returns Err(Parse(...)) if parsing fails or Err(Decode(...)) if
decoding fails.
def parse(s: String): Result[JsonError, Json]
SourceParses s as a JSON value.
Returns Ok(j) if s is a single well-formed JSON value (with
optional surrounding whitespace) and nothing else. Returns
Err(JsonError) otherwise — see Json.JsonError for the cases.
def toCompactString(j: Json): String
SourceReturns the compact JSON rendering of j: a single line with
no extraneous whitespace.
def toPrettyString(indent: Int32, j: Json): String
SourceReturns the pretty-printed JSON rendering of j, using indent spaces
per nesting level.
Empty arrays and objects are rendered on a single line as [] or {}.
Non-empty containers place each element on its own line; object keys
are followed by ": ".
def toRichString(indent: Int32, j: Json): RichString
SourceReturns the pretty-printed JSON rendering of j as a RichString,
with syntax-coloured tokens.
The layout is identical to toPrettyString. Colours: null is gray,
booleans are magenta, numbers are yellow, string values are green,
and object keys are cyan. Punctuation and whitespace use the default
colour.