besom.json

package besom.json

Members list

Type members

Classlikes

Provides additional JsonFormats and helpers

Provides additional JsonFormats and helpers

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BasicFormats

Provides the JsonFormats for the most important Scala types.

Provides the JsonFormats for the most important Scala types.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait CompactPrinter extends JsonPrinter

A JsonPrinter that produces compact JSON source without any superfluous whitespace.

A JsonPrinter that produces compact JSON source without any superfluous whitespace.

Attributes

Companion
object
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Known subtypes
object CompactPrinter.type

Attributes

Companion
trait
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Provides all the predefined JsonFormats.

Provides all the predefined JsonFormats.

Attributes

Companion
object
Supertypes
trait JsonProtocol
trait BasicFormats
class Object
trait Matchable
class Any
Show all
Known subtypes
object DefaultJsonProtocol.type

Attributes

Companion
trait
Supertypes
trait JsonProtocol
trait BasicFormats
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
case class JsArray(elements: Vector[JsValue]) extends JsValue

A JSON array.

A JSON array.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class JsValue
class Object
trait Matchable
class Any
Show all
object JsArray

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
JsArray.type
sealed abstract class JsBoolean extends JsValue

JSON Booleans.

JSON Booleans.

Attributes

Companion
object
Supertypes
class JsValue
class Object
trait Matchable
class Any
Known subtypes
object JsFalse.type
object JsTrue.type
object JsBoolean

Attributes

Companion
class
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JsBoolean.type
case object JsFalse extends JsBoolean

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class JsBoolean
class JsValue
class Object
trait Matchable
class Any
Show all
Self type
JsFalse.type
case object JsNull extends JsValue

The representation for JSON null.

The representation for JSON null.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class JsValue
class Object
trait Matchable
class Any
Show all
Self type
JsNull.type
case class JsNumber(value: BigDecimal) extends JsValue

A JSON number.

A JSON number.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class JsValue
class Object
trait Matchable
class Any
Show all
object JsNumber

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
JsNumber.type
case class JsObject(fields: Map[String, JsValue]) extends JsValue

A JSON object.

A JSON object.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class JsValue
class Object
trait Matchable
class Any
Show all
object JsObject

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
JsObject.type
case class JsString(value: String) extends JsValue

A JSON string.

A JSON string.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class JsValue
class Object
trait Matchable
class Any
Show all
object JsString

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
JsString.type
case object JsTrue extends JsBoolean

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class JsBoolean
class JsValue
class Object
trait Matchable
class Any
Show all
Self type
JsTrue.type
sealed abstract class JsValue

The general type of a JSON AST node.

The general type of a JSON AST node.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class JsArray
class JsBoolean
object JsFalse.type
object JsTrue.type
object JsNull.type
class JsNumber
class JsObject
class JsString
Show all
trait JsonFormat[T] extends JsonReader[T], JsonWriter[T]

Provides the JSON deserialization and serialization for type T.

Provides the JSON deserialization and serialization for type T.

Attributes

Companion
object
Supertypes
trait JsonWriter[T]
trait JsonReader[T]
class Object
trait Matchable
class Any
Known subtypes
object JsValueFormat.type
object BigDecimalJsonFormat.type
object BigIntJsonFormat.type
object BooleanJsonFormat.type
object ByteJsonFormat.type
object CharJsonFormat.type
object DoubleJsonFormat.type
object FloatJsonFormat.type
object IntJsonFormat.type
object LongJsonFormat.type
object ShortJsonFormat.type
object StringJsonFormat.type
object SymbolJsonFormat.type
object UnitJsonFormat.type
class OptionFormat[T]
trait RootJsonFormat[T]
object RootJsArrayFormat.type
object RootJsObjectFormat.type
Show all
object JsonFormat

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
JsonFormat.type
object JsonParser

Fast, no-dependency parser for JSON as defined by http://tools.ietf.org/html/rfc4627.

Fast, no-dependency parser for JSON as defined by http://tools.ietf.org/html/rfc4627.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
JsonParser.type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
sealed trait JsonParserSettings

Allows to customize settings for the JSON parser.

Allows to customize settings for the JSON parser.

Use it like this:

val customSettings =
 JsonParserSettings.default
   .withMaxDepth(100)
   .withMaxNumberCharacters(20)

JsonParser(jsonString, customSettings)
// or
jsonString.parseJson(customSettings)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
trait JsonPrinter extends JsValue => String

A JsonPrinter serializes a JSON AST to a String.

A JsonPrinter serializes a JSON AST to a String.

Attributes

Companion
object
Supertypes
trait JsValue => String
class Object
trait Matchable
class Any
Known subtypes
object CompactPrinter.type
object PrettyPrinter.type
object SortedPrinter.type
Show all
object JsonPrinter

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
trait BasicFormats
class Object
trait Matchable
class Any
Show all
Known subtypes
trait JsonReader[T]

Provides the JSON deserialization for type T.

Provides the JSON deserialization for type T.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait JsonFormat[T]
object JsValueFormat.type
object BigDecimalJsonFormat.type
object BigIntJsonFormat.type
object BooleanJsonFormat.type
object ByteJsonFormat.type
object CharJsonFormat.type
object DoubleJsonFormat.type
object FloatJsonFormat.type
object IntJsonFormat.type
object LongJsonFormat.type
object ShortJsonFormat.type
object StringJsonFormat.type
object SymbolJsonFormat.type
object UnitJsonFormat.type
class OptionFormat[T]
trait RootJsonFormat[T]
object RootJsArrayFormat.type
object RootJsObjectFormat.type
trait RootJsonReader[T]
Show all
object JsonReader

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
JsonReader.type
trait JsonWriter[T]

Provides the JSON serialization for type T.

Provides the JSON serialization for type T.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait JsonFormat[T]
object JsValueFormat.type
object BigDecimalJsonFormat.type
object BigIntJsonFormat.type
object BooleanJsonFormat.type
object ByteJsonFormat.type
object CharJsonFormat.type
object DoubleJsonFormat.type
object FloatJsonFormat.type
object IntJsonFormat.type
object LongJsonFormat.type
object ShortJsonFormat.type
object StringJsonFormat.type
object SymbolJsonFormat.type
object UnitJsonFormat.type
class OptionFormat[T]
trait RootJsonFormat[T]
object RootJsArrayFormat.type
object RootJsObjectFormat.type
trait RootJsonWriter[T]
Show all
object JsonWriter

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
JsonWriter.type
trait NullOptions extends ProductFormats

This trait supplies an alternative rendering mode for optional case class members. Normally optional members that are undefined (None) are not rendered at all. By mixing in this trait into your custom JsonProtocol you can enforce the rendering of undefined members as null. (Note that this only affect JSON writing, besom-json will always read missing optional members as well as null optional members as None.)

This trait supplies an alternative rendering mode for optional case class members. Normally optional members that are undefined (None) are not rendered at all. By mixing in this trait into your custom JsonProtocol you can enforce the rendering of undefined members as null. (Note that this only affect JSON writing, besom-json will always read missing optional members as well as null optional members as None.)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait ParserInput

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ParserInput

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait PrettyPrinter extends JsonPrinter

A JsonPrinter that produces a nicely readable JSON source.

A JsonPrinter that produces a nicely readable JSON source.

Attributes

Companion
object
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Known subtypes
object PrettyPrinter.type
object SortedPrinter.type
object PrettyPrinter extends PrettyPrinter

Attributes

Companion
trait
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

A special JsonFormat signaling that the format produces a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonFormat signaling that the format produces a legal JSON root object, i.e. either a JSON array or a JSON object.

Attributes

Supertypes
trait RootJsonWriter[T]
trait RootJsonReader[T]
trait JsonFormat[T]
trait JsonWriter[T]
trait JsonReader[T]
class Object
trait Matchable
class Any
Show all
Known subtypes
object RootJsArrayFormat.type
object RootJsObjectFormat.type
trait RootJsonReader[T] extends JsonReader[T]

A special JsonReader capable of reading a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonReader capable of reading a legal JSON root object, i.e. either a JSON array or a JSON object.

Attributes

Supertypes
trait JsonReader[T]
class Object
trait Matchable
class Any
Known subtypes
trait RootJsonFormat[T]
object RootJsArrayFormat.type
object RootJsObjectFormat.type
trait RootJsonWriter[T] extends JsonWriter[T]

A special JsonWriter capable of writing a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonWriter capable of writing a legal JSON root object, i.e. either a JSON array or a JSON object.

Attributes

Supertypes
trait JsonWriter[T]
class Object
trait Matchable
class Any
Known subtypes
trait RootJsonFormat[T]
object RootJsArrayFormat.type
object RootJsObjectFormat.type

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
object
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Show all
Known subtypes
object SortedPrinter.type
object SortedPrinter extends SortedPrinter

Attributes

Companion
trait
Supertypes
trait JsonPrinter
trait JsValue => String
class Object
trait Matchable
class Any
Show all
Self type

Provides the JsonFormats for the non-collection standard types.

Provides the JsonFormats for the non-collection standard types.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
object custom

This allows to perform a single import: import besom.json.* to get basic JSON behaviour. If you need to extend JSON handling in any way, please use import besom.json.custom.*, then extend DefaultJsonProtocol:

This allows to perform a single import: import besom.json.* to get basic JSON behaviour. If you need to extend JSON handling in any way, please use import besom.json.custom.*, then extend DefaultJsonProtocol:

 object MyCustomJsonProtocol extends DefaultJsonProtocol:
   given someCustomTypeFormat: JsonFormat[A] = ...

build your customized protocol that way and set it up for your derives clauses using:

 given JsonProtocol = MyCustomJsonProtocol

 case class MyCaseClass(a: String, b: Int) derives JsonFormat

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
custom.type

Value members

Concrete methods

def serializationError(msg: String): Nothing

Exports

Defined exports

Exported from BasicFormats
Exported from BasicFormats
final val ByteJsonFormat: ByteJsonFormat.type
Exported from BasicFormats
final val CharJsonFormat: CharJsonFormat.type
Exported from BasicFormats
Exported from BasicFormats
Exported from BasicFormats
final val IntJsonFormat: IntJsonFormat.type
Exported from BasicFormats
final type JF = JsonFormat
Exported from json
final type JsField = JsField
Exported from DefaultExports
final val JsValueFormat: JsValueFormat.type
Exported from AdditionalFormats
final val LongJsonFormat: LongJsonFormat.type
Exported from BasicFormats
final type OptionFormat = OptionFormat
Exported from StandardFormats
Exported from AdditionalFormats
Exported from BasicFormats
Exported from BasicFormats
Exported from BasicFormats
final val UnitJsonFormat: UnitJsonFormat.type
Exported from BasicFormats
Exported from CollectionFormats

Supplies the JsonFormat for Arrays.

Supplies the JsonFormat for Arrays.

Attributes

Exported from DefaultProtocol
Exported from StandardFormats
implicit def enrichAny[T](any: T): RichAny[T]
Exported from DefaultExports
Exported from CollectionFormats
Exported from CollectionFormats
Exported from AdditionalFormats

Constructs a JsonFormat from its two parts, JsonReader and JsonWriter.

Constructs a JsonFormat from its two parts, JsonReader and JsonWriter.

Attributes

inline def jsonFormatN[T <: Product]: RootJsonFormat[T]
Exported from ProductFormats
def jsonReader[T](implicit reader: JsonReader[T]): JsonReader[T]
Exported from DefaultExports
def jsonWriter[T](implicit writer: JsonWriter[T]): JsonWriter[T]
Exported from DefaultExports
Exported from AdditionalFormats

Lazy wrapper around serialization. Useful when you want to serialize (mutually) recursive structures.

Lazy wrapper around serialization. Useful when you want to serialize (mutually) recursive structures.

Attributes

def lift[T <: AnyRef](reader: RootJsonReader[T]): RootJsonFormat[T]
Exported from AdditionalFormats

Turns a RootJsonReader into a RootJsonFormat that throws an UnsupportedOperationException for writes.

Turns a RootJsonReader into a RootJsonFormat that throws an UnsupportedOperationException for writes.

Attributes

def lift[T <: AnyRef](reader: JsonReader[T]): JsonFormat[T]
Exported from AdditionalFormats

Turns a JsonReader into a JsonFormat that throws an UnsupportedOperationException for writes.

Turns a JsonReader into a JsonFormat that throws an UnsupportedOperationException for writes.

Attributes

Exported from AdditionalFormats

Turns a RootJsonWriter into a RootJsonFormat that throws an UnsupportedOperationException for reads.

Turns a RootJsonWriter into a RootJsonFormat that throws an UnsupportedOperationException for reads.

Attributes

Exported from AdditionalFormats

Turns a JsonWriter into a JsonFormat that throws an UnsupportedOperationException for reads.

Turns a JsonWriter into a JsonFormat that throws an UnsupportedOperationException for reads.

Attributes

Exported from CollectionFormats

Supplies the JsonFormat for Lists.

Supplies the JsonFormat for Lists.

Attributes

Exported from CollectionFormats

Supplies the JsonFormat for Maps. The implicitly available JsonFormat for the key type K must always write JsStrings, otherwise a besom.json.SerializationException will be thrown.

Supplies the JsonFormat for Maps. The implicitly available JsonFormat for the key type K must always write JsStrings, otherwise a besom.json.SerializationException will be thrown.

Attributes

Exported from StandardFormats
Exported from AdditionalFormats

Explicitly turns a JsonFormat into a RootJsonFormat.

Explicitly turns a JsonFormat into a RootJsonFormat.

Attributes

Exported from AdditionalFormats

Constructs a RootJsonFormat from its two parts, RootJsonReader and RootJsonWriter.

Constructs a RootJsonFormat from its two parts, RootJsonReader and RootJsonWriter.

Attributes

Exported from AdditionalFormats

Wraps an existing JsonReader with Exception protection.

Wraps an existing JsonReader with Exception protection.

Attributes

implicit def seqFormat[T : JsonFormat]: RootJsonFormat[Seq[T]]
Exported from CollectionFormats
implicit def setFormat[T : JsonFormat]: RootJsonFormat[Set[T]]
Exported from CollectionFormats
implicit def tuple1Format[A : JsonFormat]: JsonFormat[(A)]
Exported from StandardFormats
Exported from StandardFormats
Exported from StandardFormats
Exported from StandardFormats
Exported from StandardFormats
Exported from StandardFormats
Exported from CollectionFormats
Exported from ProductFormats