Packages

package json

Provides support for parsing and stringifying JSON.

This module is a new implementation; it does not depend on packages such as Jackson. This choice was to provide the following features:

  • fewer dependencies, to make it easier to embed Histogrammar
  • concise pattern-matching in org.dianahep.histogrammar.Container fromJsonFragment methods
  • special handling of "-inf", "inf", "nan" as numbers, rather than strings
  • partial parsing failures return None, rather than raising exceptions.
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. json
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. implicit class HasKeySet extends AnyRef
  2. class InvalidJsonException extends Exception

    Exception type for strings that cannot be parsed because they are not proper JSON.

  3. sealed trait Json extends AnyRef

    Interface for all parsed, in-memory JSON objects.

  4. case class JsonArray(elements: Json*) extends JsonContainer with Product with Serializable

    Concrete class for JSON arrays.

    Concrete class for JSON arrays.

    elements

    Note: a varargs sequence; to fill from a Scala Seq, use the myseq: _* syntax.

  5. trait JsonBoolean extends JsonPrimitive

    Interface for JSON booleans (true and false).

  6. trait JsonContainer extends Json

    Interface for all JSON containers: arrays and objects (mappings).

  7. case class JsonFloat(value: Double) extends JsonNumber with Product with Serializable

    Concrete class for JSON floating point numbers.

    Concrete class for JSON floating point numbers.

    (Double type for more generality than Float, though the JSON spec allows arbitrary precision).

  8. class JsonFormatException extends Exception

    Exception type for unexpected JSON structure, thrown by fromJson methods.

  9. case class JsonInt(value: Long) extends JsonNumber with Product with Serializable

    Concrete class for JSON integers.

    Concrete class for JSON integers.

    (Long type for more generality than Int, though the JSON spec allows arbitrary precision).

  10. trait JsonNumber extends JsonPrimitive

    Interface for JSON numbers, both integral and floating point.

  11. case class JsonObject(pairs: (JsonString, Json)*) extends JsonContainer with Product with Serializable

    Concrete class for JSON objects (mappings).

    Concrete class for JSON objects (mappings).

    pairs

    Note: a varargs sequence; to fill from a Scala Seq, use the myseq: _* syntax.

  12. trait JsonPrimitive extends Json

    Interface for all JSON primitives: null, true, false, numbers, and strings.

  13. case class JsonString(value: String) extends JsonPrimitive with Product with Serializable

    Concrete class for JSON strings.

    Concrete class for JSON strings.

    Note: the strings "-inf", "inf", and "nan" can be interpreted as numbers by org.dianahep.histogrammar.json.JsonNumber. If JsonNumber parsing is attempted before JsonString in an orElse chain, these three values would become numbers; otherwise they would become strings. Standard parsing (provided by the org.dianahep.histogrammar.json.JsonPrimitive and org.dianahep.histogrammar.json.Json objects) attempts to interpret them as numbers first.

  14. case class ParseState(str: String, pos: Int = 0) extends Product with Serializable

    Status of JSON-parsing an in-memory string.

    Status of JSON-parsing an in-memory string. Holds the position (pos), allows peeking (remaining), and manages a stack of unwind-protection.

Value Members

  1. implicit def booleanToJson(x: Boolean): JsonBoolean with Product with Serializable
  2. implicit def byteToJson(x: Byte): JsonInt
  3. implicit def charToJson(x: Char): JsonString
  4. implicit def doubleToJson(x: Double): JsonFloat
  5. implicit def floatToJson(x: Float): JsonFloat
  6. implicit def intToJson(x: Int): JsonInt
  7. implicit def longToJson(x: Long): JsonInt
  8. implicit def shortToJson(x: Short): JsonInt
  9. implicit def stringToJson(x: String): JsonString
  10. object Json

    Entry point for parsing JSON.

  11. object JsonArray extends Serializable
  12. object JsonBoolean
  13. object JsonContainer
  14. case object JsonFalse extends JsonBoolean with Product with Serializable

    Concrete singleton for JSON false.

  15. object JsonFloat extends Serializable
  16. object JsonInt extends Serializable
  17. case object JsonNull extends JsonPrimitive with Product with Serializable

    Concrete singleton for JSON null.

  18. object JsonNumber
  19. object JsonObject extends Serializable
  20. object JsonPrimitive
  21. object JsonString extends Serializable
  22. case object JsonTrue extends JsonBoolean with Product with Serializable

    Concrete singleton for JSON true.

Inherited from AnyRef

Inherited from Any

Ungrouped