Num

sealed trait Num extends Json
trait Json
class Any
class NumDec
class NumInt

Type members

Inherited types

type Type
Inherited from:
Json

Value members

Abstract methods

def asBigDecimal: BigDecimal

Convenience method for asNum.value

Convenience method for asNum.value

def asBigInt: BigInt
def asDouble: Double
def asFloat: Float
def asInt: Int
def asLong: Long

Inherited methods

The type of value

The type of value

Inherited from:
Json
final def apply(path: Path): Json

Looks up a Value based on Path

Looks up a Value based on Path

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

Inherited from:
Json
final def apply(lookup: String): Json

Looks up a Value by name in the children.

Looks up a Value by name in the children.

Throws an exception if invoked on anything except Obj

Inherited from:
Json
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

Inherited from:
Json

Casts to Bool or throws an exception if not a Bool

Casts to Bool or throws an exception if not a Bool

Inherited from:
Json
def asBoolean: Boolean

Convenience method for asBool.value

Convenience method for asBool.value

Inherited from:
Json
def asByte: Byte
Inherited from:
Json
def asMap: ListMap[String, Json]

Convenience method for asObj.value

Convenience method for asObj.value

Inherited from:
Json
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

Inherited from:
Json

Casts to NumDec or throws an exception if not a NumDec

Casts to NumDec or throws an exception if not a NumDec

Inherited from:
Json

Casts to NumInt or throws an exception if not a NumInt

Casts to NumInt or throws an exception if not a NumInt

Inherited from:
Json
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

Inherited from:
Json
def asShort: Short
Inherited from:
Json
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

Inherited from:
Json
def asString: String

Convenience method for asStr.value

Convenience method for asStr.value

Inherited from:
Json
def asValue[V <: Json](`type`: ValueType[V]): V

Safely casts this Value as the specified ValueType. Throws an exception if not a match.

Safely casts this Value as the specified ValueType. Throws an exception if not a match.

Type parameters:
V

the return type

Value parameters:
`type`

the type to cast this ValueType as

Inherited from:
Json
def asVector: Vector[Json]

Convenience method for asArr.value

Convenience method for asArr.value

Inherited from:
Json
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[Value]

Inherited from:
Json
final def get(path: Path): Option[Json]

Looks up a Value based on Path

Looks up a Value based on Path

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

Inherited from:
Json
final def get(lookup: String): Option[Json]

Looks up a Value by name in the children.

Looks up a Value by name in the children.

Inherited from:
Json
def getArr: Option[Arr]

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

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

Inherited from:
Json
def getBigDecimal: Option[BigDecimal]

Convenience method for getNum.map(_.value)

Convenience method for getNum.map(_.value)

Inherited from:
Json
def getBool: Option[Bool]

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

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

Inherited from:
Json
def getBoolean: Option[Boolean]

Convenience method for getBool.map(_.value)

Convenience method for getBool.map(_.value)

Inherited from:
Json
def getByte: Option[Byte]
Inherited from:
Json
def getDouble: Option[Double]
Inherited from:
Json
def getFloat: Option[Float]
Inherited from:
Json
def getInt: Option[Int]
Inherited from:
Json
def getLong: Option[Long]
Inherited from:
Json
def getMap: Option[Map[String, Json]]

Convenience method for getObj.map(_.value)

Convenience method for getObj.map(_.value)

Inherited from:
Json
def getNum: Option[Num]

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

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

Inherited from:
Json
def getObj: Option[Obj]

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

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

Inherited from:
Json
final def getOrCreate(lookup: String): Json

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

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

Inherited from:
Json
def getShort: Option[Short]
Inherited from:
Json
def getStr: Option[Str]

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

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

Inherited from:
Json
def getString: Option[String]

Convenience method for getStr.map(_.value)

Convenience method for getStr.map(_.value)

Inherited from:
Json
final def getValue[V <: Json](`type`: ValueType[V]): Option[V]

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

Safely casts this Value as the specified ValueType. 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]

Inherited from:
Json
def getVector: Option[Vector[Json]]

Convenience method for getArr.map(_.value)

Convenience method for getArr.map(_.value)

Inherited from:
Json
def isArr: Boolean

True if this is an Arr

True if this is an Arr

Inherited from:
Json
def isBool: Boolean

True if this is a Bool

True if this is a Bool

Inherited from:
Json
def isEmpty: Boolean
Inherited from:
Json
def isNull: Boolean

True if this is a Null

True if this is a Null

Inherited from:
Json
def isNum: Boolean

True if this is a Num

True if this is a Num

Inherited from:
Json
def isNumDec: Boolean
Inherited from:
Json
def isNumInt: Boolean
Inherited from:
Json
def isObj: Boolean

True if this is an Obj

True if this is an Obj

Inherited from:
Json
def isStr: Boolean

True if this is a Str

True if this is a Str

Inherited from:
Json
def merge(value: Json, path: Path, `type`: MergeType): Json

Merges a Value at the specified path

Merges a Value at the specified path

Value parameters:
`type`

the merge type (defaults to MergeType.Overwrite)

path

the path (defaults to Path.empty)

value

the value to merge

Returns:

root Value after merge

Inherited from:
Json
def modify(path: Path)(f: Json => Json): Json

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

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

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

Value parameters:
f

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

path

the path to modify

Returns:

new root Value representing the changes

Inherited from:
Json
def nonEmpty: Boolean
Inherited from:
Json
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 Value representing the changes

Inherited from:
Json
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 Value representing the changes

Inherited from:
Json