sealed trait Json extends Any
Json represents the base sealed trait for all representable types in Fabric.
- Source
- Json.scala
- Alphabetic
- By Inheritance
- Json
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Type
Abstract Value Members
- abstract def genKey(b: StringBuilder): Unit
Generates a consistent key from this JSON.
Generates a consistent key from this JSON. This can be useful for comparison or unique reference.
- abstract def getClass(): Class[_ <: AnyRef]
- Definition Classes
- Any
- abstract def isEmpty: Boolean
- abstract def type: JsonType[Type]
The type of value
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##: Int
- Definition Classes
- Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- final def apply(path: JsonPath): Json
Looks up a Json based on Path
Looks up a Json based on Path
Example:
val v = someValue("first" \ "second" \ "third")
- 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
- def asArr: Arr
Casts to Arr or throws an exception if not an Arr
- def asBigDecimal: BigDecimal
Convenience method for asNum.value
- def asBool: Bool
Casts to Bool or throws an exception if not a Bool
- def asBoolean: Boolean
Convenience method for asBool.value
- def asByte: Byte
- def asDouble: Double
- def asFloat: Float
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asInt: Int
- def asLong: Long
- def asMap: Map[String, Json]
Convenience method for asObj.value
- def asNum: Num
Casts to Num or throws an exception if not a Num
- def asNumDec: NumDec
Casts to NumDec or throws an exception if not a NumDec
- def asNumInt: NumInt
Casts to NumInt or throws an exception if not a NumInt
- def asObj: Obj
Casts to Obj or throws an exception if not an Obj
- def asShort: Short
- def asStr: Str
Casts to Str or throws an exception if not a Str
- def asString: String
Convenience method for asStr.value
- def asType[V <: Json](type: JsonType[V]): V
Safely casts this Json as the specified JsonType.
Safely casts this Json as the specified JsonType. Throws an exception if not a match.
- V
the return type
- def asVector: Vector[Json]
Convenience method for asArr.value
- def equals(arg0: Any): Boolean
- Definition Classes
- Any
- final def filter(filter: JsonFilter): 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.
- filter
the filter to apply
- returns
Option[Json]
- final def filterOne(filter: JsonFilter): Json
- final def get(path: JsonPath): 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")
- final def get(lookup: JsonPathEntry): Option[Json]
- final def get(lookup: String): Option[Json]
Looks up a Json by name in the children.
- def getArr: Option[Arr]
Casts to Arr if it's of Arr type or returns None
- final def getAsType[V <: Json](type: JsonType[V]): Option[V]
Safely casts this Json as the specified JsonType.
Safely casts this Json as the specified JsonType. Returns None if it's a different type.
- V
the value type
- returns
Option[V]
- def getBigDecimal: Option[BigDecimal]
Convenience method for getNum.map(_.value)
- def getBool: Option[Bool]
Casts to Bool if it's of Bool type or returns None
- def getBoolean: Option[Boolean]
Convenience method for getBool.map(_.value)
- def getByte: Option[Byte]
- def getDouble: Option[Double]
- def getFloat: Option[Float]
- def getInt: Option[Int]
- def getLong: Option[Long]
- def getMap: Option[Map[String, Json]]
Convenience method for getObj.map(_.value)
- def getNum: Option[Num]
Casts to Num if it's of Num type or returns None
- def getObj: Option[Obj]
Casts to Obj if it's of Obj type or returns None
- final def getOrCreate(lookup: JsonPathEntry): Json
Looks up a Json by name in the children or creates a new Obj if it doesn't exist.
- def getShort: Option[Short]
- def getStr: Option[Str]
Casts to Str if it's of Str type or returns None
- def getString: Option[String]
Convenience method for getStr.map(_.value)
- def getVector: Option[Vector[Json]]
Convenience method for getArr.map(_.value)
- def hashCode(): Int
- Definition Classes
- Any
- def isArr: Boolean
True if this is an Arr
- def isBool: Boolean
True if this is a Bool
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isNull: Boolean
True if this is a Null
- def isNum: Boolean
True if this is a Num
- def isNumDec: Boolean
- def isNumInt: Boolean
- def isObj: Boolean
True if this is an Obj
- def isStr: Boolean
True if this is a Str
- final def merge(value: Json, path: JsonPath = JsonPath.empty, config: MergeConfig = MergeConfig): Json
Merges a Json at the specified path
Merges a Json at the specified path
- value
the value to merge
- path
the path (defaults to Path.empty)
- config
the merge configuration (defaults to MergeConfig)
- returns
root Json after merge
- def modify(path: JsonPath)(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.
- path
the path to modify
- f
the function that takes the current Json and returns the modified Json
- returns
new root Json representing the changes
- def nonEmpty: Boolean
- def remove(path: JsonPath): 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.
- path
the path to remove
- returns
new root Json representing the changes
- def search(entries: SearchEntry*): List[JsonPath]
- def set(path: JsonPath, 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.
- path
the path to replace
- value
the new value to set
- returns
new root Json representing the changes
- def toKey: String
Generates a consistent key from this JSON.
Generates a consistent key from this JSON. This can be useful for comparison or unique reference. Convenience wrapper for genKey.
- def toString(): String
- Definition Classes
- Any
- def transform(search: Search): Transformer