Json

sealed trait Json

Json represents the base sealed trait for all representable types in Fabric.

Companion:
object
Source:
Json.scala
class Any
class Arr
class Bool
trait Null
object Null.type
trait Num
class NumDec
class NumInt
class Obj
class Str

Type members

Types

type Type
Source:
Json.scala

Value members

Abstract methods

The type of value

The type of value

Source:
Json.scala

Concrete methods

final def apply(lookup: String): Json

Looks up a Json by name in the children.

Looks up a Json by name in the children.

Throws an exception if invoked on anything except Obj

Source:
Json.scala
final def apply(path: Path): Json

Looks up a Json based on Path

Looks up a Json based on Path

Example: val v = someValue("first" \ "second" \ "third")

Source:
Json.scala
def asArr: Arr

Casts to Arr or throws an exception if not an Arr

Casts to Arr or throws an exception if not an Arr

Source:
Json.scala

Convenience method for asNum.value

Convenience method for asNum.value

Source:
Json.scala

Casts to Bool or throws an exception if not a Bool

Casts to Bool or throws an exception if not a Bool

Source:
Json.scala

Convenience method for asBool.value

Convenience method for asBool.value

Source:
Json.scala
def asInt: Int
Source:
Json.scala

Convenience method for asObj.value

Convenience method for asObj.value

Source:
Json.scala
def asNum: Num

Casts to Num or throws an exception if not a Num

Casts to Num or throws an exception if not a Num

Source:
Json.scala

Casts to NumDec or throws an exception if not a NumDec

Casts to NumDec or throws an exception if not a NumDec

Source:
Json.scala

Casts to NumInt or throws an exception if not a NumInt

Casts to NumInt or throws an exception if not a NumInt

Source:
Json.scala
def asObj: Obj

Casts to Obj or throws an exception if not an Obj

Casts to Obj or throws an exception if not an Obj

Source:
Json.scala
def asStr: Str

Casts to Str or throws an exception if not a Str

Casts to Str or throws an exception if not a Str

Source:
Json.scala

Convenience method for asStr.value

Convenience method for asStr.value

Source:
Json.scala
def asType[V <: Json](`type`: JsonType[V]): V

Safely casts this Json as the specified JsonType. Throws an exception if not a match.

Safely casts this Json as the specified JsonType. Throws an exception if not a match.

Type parameters:
V

the return type

Value parameters:
`type`

the type to cast this JsonType as

Source:
Json.scala

Convenience method for asArr.value

Convenience method for asArr.value

Source:
Json.scala
def filter(filter: ValueFilter): Option[Json]

Applies the filter recursively to this value beginning on the leafs working backward up the tree back to the root.

Applies the filter recursively to this value beginning on the leafs working backward up the tree back to the root.

Value parameters:
filter

the filter to apply

Returns:

Option[Json]

Source:
Json.scala
final def get(lookup: String): Option[Json]

Looks up a Json by name in the children.

Looks up a Json by name in the children.

Source:
Json.scala
final def get(path: Path): Option[Json]

Looks up a Json based on Path

Looks up a Json based on Path

Example: val o: Option[Json] = someValue("first" \ "second" \ "third")

Source:
Json.scala

Casts to Arr if it's of Arr type or returns None

Casts to Arr if it's of Arr type or returns None

Source:
Json.scala
final def getAsType[V <: Json](`type`: JsonType[V]): Option[V]

Safely casts this Json as the specified JsonType. Returns None if it's a different type.

Safely casts this Json as the specified JsonType. Returns None if it's a different type.

Type parameters:
V

the value type

Value parameters:
`type`

the value type of value you want.

Returns:

Option[V]

Source:
Json.scala

Convenience method for getNum.map(_.value)

Convenience method for getNum.map(_.value)

Source:
Json.scala

Casts to Bool if it's of Bool type or returns None

Casts to Bool if it's of Bool type or returns None

Source:
Json.scala

Convenience method for getBool.map(_.value)

Convenience method for getBool.map(_.value)

Source:
Json.scala

Convenience method for getObj.map(_.value)

Convenience method for getObj.map(_.value)

Source:
Json.scala

Casts to Num if it's of Num type or returns None

Casts to Num if it's of Num type or returns None

Source:
Json.scala

Casts to Obj if it's of Obj type or returns None

Casts to Obj if it's of Obj type or returns None

Source:
Json.scala
final def getOrCreate(lookup: String): Json

Looks up a Json by name in the children or creates a new Obj if it doesn't exist.

Looks up a Json by name in the children or creates a new Obj if it doesn't exist.

Source:
Json.scala

Casts to Str if it's of Str type or returns None

Casts to Str if it's of Str type or returns None

Source:
Json.scala

Convenience method for getStr.map(_.value)

Convenience method for getStr.map(_.value)

Source:
Json.scala

Convenience method for getArr.map(_.value)

Convenience method for getArr.map(_.value)

Source:
Json.scala

True if this is an Arr

True if this is an Arr

Source:
Json.scala

True if this is a Bool

True if this is a Bool

Source:
Json.scala

True if this is a Null

True if this is a Null

Source:
Json.scala

True if this is a Num

True if this is a Num

Source:
Json.scala

True if this is an Obj

True if this is an Obj

Source:
Json.scala

True if this is a Str

True if this is a Str

Source:
Json.scala
final def merge(value: Json, path: Path, config: MergeConfig): Json

Merges a Json at the specified path

Merges a Json at the specified path

Value parameters:
config

the merge configuration (defaults to MergeConfig)

path

the path (defaults to Path.empty)

value

the value to merge

Returns:

root Json after merge

Source:
Json.scala
def modify(path: Path)(f: Json => Json): Json

Modifies the value at the specified path and returns back a new root Json with the modified path.

Modifies the value at the specified path and returns back a new root Json with the modified path.

Note: We use the term "modify" here from an immutable standpoint. The original Json will not change.

Value parameters:
f

the function that takes the current Json and returns the modified Json

path

the path to modify

Returns:

new root Json representing the changes

Source:
Json.scala
def remove(path: Path): Json

Convenience functionality for #modify to remove the value at a specific path.

Convenience functionality for #modify to remove the value at a specific path.

Value parameters:
path

the path to remove

Returns:

new root Json representing the changes

Source:
Json.scala
def set(path: Path, value: Json): Json

Convenience functionality for #modify to set a specific value at a path.

Convenience functionality for #modify to set a specific value at a path.

Value parameters:
path

the path to replace

value

the new value to set

Returns:

new root Json representing the changes

Source:
Json.scala