A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.playframework.com/documentation/2.5.x/api/scala/play/api/libs/json/Json$.html below:

Json - play.api.libs.json.Json

  • final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  • final def ##(): Int
    Definition Classes
    AnyRef → Any
  • final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  • def arr(fields: JsValueWrapper*): JsArray
  • final def asInstanceOf[T0]: T0
  • def asciiStringify(json: JsValue): String

    Convert a JsValue to its string representation, escaping all non-ascii characters using \uXXXX syntax.

    Convert a JsValue to its string representation, escaping all non-ascii characters using \uXXXX syntax.

    This is particularly useful when the output JSON will be executed as javascript, since JSON is not a strict subset of javascript (see JSON: The JavaScript subset that isn't).

    scala> Json.asciiStringify(JsString("some\u2028text\u2029"))
    res0: String = "some\u2028text\u2029"
    
    scala> Json.stringify(JsString("some\u2028text\u2029"))
    res1: String = "sometext"
    json

    the JsValue to convert

    returns

    a String with the json representation with all non-ascii characters escaped.

  • def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  • final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  • def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  • def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  • macro def format[A]: OFormat[A]

    Creates a Format[T] by resolving case class fields & required implicits at COMPILE-time

    Creates a Format[T] by resolving case class fields & required implicits at COMPILE-time

    If any missing implicit is discovered, compiler will break with corresponding error.

    import play.api.libs.json.Json
    
    case class User(name: String, age: Int)
    
    implicit val userWrites = Json.format[User]
    // macro-compiler replaces Json.format[User] by injecting into compile chain
    // the exact code you would write yourself. This is strictly equivalent to:
    implicit val userWrites = (
       (__ \ 'name).format[String] and
       (__ \ 'age).format[Int]
    )(User.apply, unlift(User.unapply))
  • def fromJson[T](json: JsValue)(implicit fjs: Reads[T]): JsResult[T]

    Provided a Reads implicit for that type is available, convert a JsValue to any type.

    Provided a Reads implicit for that type is available, convert a JsValue to any type.

    json

    Json value to transform as an instance of T.

  • final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  • def hashCode(): Int
    Definition Classes
    AnyRef → Any
  • final def isInstanceOf[T0]: Boolean
  • final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  • final def notify(): Unit
    Definition Classes
    AnyRef
  • final def notifyAll(): Unit
    Definition Classes
    AnyRef
  • def obj(fields: (String, JsValueWrapper)*): JsObject
  • def parse(input: Array[Byte]): JsValue

    Parse a byte array representing a json, and return it as a JsValue.

    Parse a byte array representing a json, and return it as a JsValue.

    The character encoding used will be automatically detected as UTF-8, UTF-16 or UTF-32, as per the heuristics in RFC-4627.

    input

    a byte array to parse

    returns

    the JsValue representing the byte array

  • def parse(input: InputStream): JsValue

    Parse an InputStream representing a json, and return it as a JsValue.

    Parse an InputStream representing a json, and return it as a JsValue.

    input

    as InputStream to parse

    returns

    the JsValue representing the InputStream

  • def parse(input: String): JsValue

    Parse a String representing a json, and return it as a JsValue.

    Parse a String representing a json, and return it as a JsValue.

    input

    a String to parse

    returns

    the JsValue representing the string

  • def prettyPrint(json: JsValue): String

    Convert a JsValue to its pretty string representation using default Jackson pretty printer (line feeds after each fields and 2-spaces indentation).

    Convert a JsValue to its pretty string representation using default Jackson pretty printer (line feeds after each fields and 2-spaces indentation).

    scala> Json.stringify(Json.obj(
      "field1" -> Json.obj(
        "field11" -> "value11",
        "field12" -> Json.arr("alpha", 123L)
      )
    ))
    res0: String = {"field1":{"field11":"value11","field12":["alpha",123]}}
    
    scala> Json.prettyPrint(res0)
    res1: String =
    {
      "field1" : {
        "field11" : "value11",
        "field12" : [ "alpha", 123 ]
      }
    }
    json

    the JsValue to convert

    returns

    a String with the json representation

  • macro def reads[A]: Reads[A]

    Creates a Reads[T] by resolving case class fields & required implicits at COMPILE-time.

    Creates a Reads[T] by resolving case class fields & required implicits at COMPILE-time.

    If any missing implicit is discovered, compiler will break with corresponding error.

    import play.api.libs.json.Json
    
    case class User(name: String, age: Int)
    
    implicit val userReads = Json.reads[User]
    // macro-compiler replaces Json.reads[User] by injecting into compile chain
    // the exact code you would write yourself. This is strictly equivalent to:
    implicit val userReads = (
       (__ \ 'name).read[String] and
       (__ \ 'age).read[Int]
    )(User)
  • def stringify(json: JsValue): String

    Convert a JsValue to its string representation.

    Convert a JsValue to its string representation.

    scala> Json.stringify(Json.obj(
      "field1" -> Json.obj(
        "field11" -> "value11",
        "field12" -> Json.arr("alpha", 123L)
      )
    ))
    res0: String = {"field1":{"field11":"value11","field12":["alpha",123]}}
    
    scala> Json.stringify(res0)
    res1: String = {"field1":{"field11":"value11","field12":["alpha",123]}}
    json

    the JsValue to convert

    returns

    a String with the json representation

  • final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  • implicit def toJsFieldJsValueWrapper[T](field: T)(implicit w: Writes[T]): JsValueWrapper
  • def toJson[T](o: T)(implicit tjs: Writes[T]): JsValue

    Provided a Writes implicit for its type is available, convert any object into a JsValue.

    Provided a Writes implicit for its type is available, convert any object into a JsValue.

    o

    Value to convert in Json.

  • def toString(): String
    Definition Classes
    AnyRef → Any
  • final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  • final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  • final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  • macro def writes[A]: OWrites[A]

    Creates a Writes[T] by resolving case class fields & required implicits at COMPILE-time

    Creates a Writes[T] by resolving case class fields & required implicits at COMPILE-time

    If any missing implicit is discovered, compiler will break with corresponding error.

    import play.api.libs.json.Json
    
    case class User(name: String, age: Int)
    
    implicit val userWrites = Json.writes[User]
    // macro-compiler replaces Json.writes[User] by injecting into compile chain
    // the exact code you would write yourself. This is strictly equivalent to:
    implicit val userWrites = (
       (__ \ 'name).write[String] and
       (__ \ 'age).write[Int]
    )(unlift(User.unapply))

  • RetroSearch is an open source project built by @garambo | Open a GitHub Issue

    Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

    HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4