JsonUtils

zio.json.ast.JsonUtils$
object JsonUtils

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def anyToJson(value: Any): Json
def cleanValue(json: Json): Json
def filterValid(properties: (String, Json)*): Seq[(String, Json)]

Filters a series of properties, keeping only the valid ones.

Filters a series of properties, keeping only the valid ones.

Attributes

def isValidJsonProperty(property: (String, Json)): Boolean

Determines if a property (String, Json) is valid, by testing the Json in the second item.

Determines if a property (String, Json) is valid, by testing the Json in the second item.

Attributes

def joClean(json: Json): Json
def jsClean(fields: (String, Json)*): Json
def jsToAny(value: Json): Any
def mapToJson(map: Map[_, _]): Json
def mergeJsonList(items: List[Json]): Json
def resolveFieldMultiple[T : JsonDecoder](json: Json, field: String): Chunk[Either[String, T]]
def resolveSingleField[T : JsonDecoder](json: Json, field: String): Option[Either[String, T]]
def toJsonIfFull[T](value: Seq[T])(implicit enc: JsonEncoder[T]): Either[String, Json]
def toJsonIfFull[T, S](value: Seq[T], xform: T => S)(implicit enc: JsonEncoder[S]): Either[String, Json]
def toJsonIfNot[T](value: T, default: T)(implicit enc: JsonEncoder[T]): Either[String, Json]

Create a Json from value, which is valid if value is not equal to default.

Create a Json from value, which is valid if value is not equal to default.

Attributes

def toJsonIfNot[T, S](value: T, default: T, xform: T => S)(implicit enc: JsonEncoder[S]): Either[String, Json]

Create a Json from xform applied to value, which is valid if value is not equal to default.

Create a Json from xform applied to value, which is valid if value is not equal to default.

Attributes

def toJsonIfValid[T](value: T, isValid: T => Boolean)(implicit enc: JsonEncoder[T]): Either[String, Json]

These functions are used to create Json objects from filtered sequences of (String, Json) tuples. When the Json in a tuple is Json.Null or JsUndefined or an empty Json.Obj, that tuple is considered not valid, and will be filtered out. Create a Json from value, which is valid if the isValid function applied to value is true.

These functions are used to create Json objects from filtered sequences of (String, Json) tuples. When the Json in a tuple is Json.Null or JsUndefined or an empty Json.Obj, that tuple is considered not valid, and will be filtered out. Create a Json from value, which is valid if the isValid function applied to value is true.

Attributes

def toJsonIfValid[T, S](value: T, isValid: T => Boolean, xform: T => S)(implicit enc: JsonEncoder[S]): Either[String, Json]

Create a Json from xform applied to value, which is valid if the isValid function applied to value is true.

Create a Json from xform applied to value, which is valid if the isValid function applied to value is true.

Attributes

def toJsonObject(properties: (String, Json)*): Json

Create a Json object by filtering a series of properties.

Create a Json object by filtering a series of properties.

Attributes