com.paypal.cascade

json

package json

Convenience implicits for reading objects from and writing objects to JSON Strings

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. json
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. implicit class Convertible extends AnyRef

    Implicit conversions from an arbitrary JSON object to a variety of object types.

    Implicit conversions from an arbitrary JSON object to a variety of object types.

    import com.paypal.cascade.json._
    case class JsonPatch(op: String, path: String, value: Option[Any])
    case class AnObject(...)
    val jsonStr = JsonPatch("add", "/-", Some(AnObject(...)))).toJson.get
    val a = jsonStr.fromJson[JsonPatch].get
    val inner = a.value.convertValue[Option[AnObject]].get
  2. implicit class Marshallable[T] extends AnyRef

    Implicit conversions from a given object of type T to a JSON String

    Implicit conversions from a given object of type T to a JSON String

    import com.paypal.cascade.json._
    case class AnObject(v1: String, v2: Long, v3: List[String])
    val a = AnObject("value", 5L, List("hi", "there")
    a.toJson
    T

    the type of this object

  3. implicit class Unmarshallable extends AnyRef

    Implicit conversions from a JSON String to a variety of object types.

    Implicit conversions from a JSON String to a variety of object types.

    import com.paypal.cascade.json._
    """{"key":"value"}""".toMap

Value Members

  1. object JsonUtil

    Patterns adapted from https://coderwall.com/p/o--apg

    Patterns adapted from https://coderwall.com/p/o--apg

    Known caveats:

    • If Jackson is instructed to deserialize a non-conforming numeric from a String, it will fail, e.g attempting to deser an Int from "hello". Conversely, if Jackson is instructed to deser a String from a numeric, it will succeed, e.g. "100" from 100. If an object has an obvious String representation, Jackson will attempt to treat it as such.
    • Null values will be treated as valid JSON. This is because null is a valid JSON value. Case classes that will be serialized/deser'd need to include their own validation to guard against unintentional nulls.

Inherited from AnyRef

Inherited from Any

Ungrouped