com

persist

package persist

Visibility
  1. Public
  2. All

Value Members

  1. object Exceptions

    This object defines the Exceptions used within Persist-Json.

  2. object JsonMapper

    This object has methods that use reflection for converting between Json and user defined case classes.

    This object has methods that use reflection for converting between Json and user defined case classes. Here is an example:

    import com.persist.JsonOps._
    import com.persist.JsonMapper._
    
    case class Person(name:String, age:Option[Int])
    case class Group(city: String, people:Seq[Person], var cnt:Int, props:JsonObject)
    
    val j:Json = Json("""{city:"Seattle", cnt:2, props:{i:1, j:2},
                          people:[{name:"Joe"},
                                  {name:"Tom", age:20}]
                         }""")
    
    val group:Group = ToObject[Group](j)
    
    val j1:Json = ToJson(group)
    
    assert(j1 == j)
  3. object JsonOps

    Provides types and functions for working with Json types.

    Provides types and functions for working with Json types.

    Json is represented by immutable Scala types. Instead of having separate Json types, type aliases are defined for Json forms.

    Scala types used for Json are

    - Json Object. Immutable Map[String,Json]. Note that keys are not ordered. When converting to a string with Compact or Pretty keys are sorted. - Json Array. Immutable Seq[Json] - Json String. String - Json Boolean. Boolean - Json Number. Int, Long, BigDecimal (with .), Double (with e) - Json Null. Null

    Any of the Json types can be at the top level of a document (not just array and object).

    The Json parser supports some extensions that are useful for human edited Json input (such as configurations).

    - Comments. The characters // to end of line are discarded during parsing. - Scala-like raw strings. Start with ""{ and end with }"". Treated as normal strings after parsing. - No quotes on simple names. If an object component name starts with a letter and contains only letters and digits the " quotes are not required. After parsing names with and without quotes are not distinguished.

  4. package json

Ungrouped