You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,14 @@ scala-jsonapi is a Scala library that aims to help you produce JSON output based
10
10
*[Play-JSON]
11
11
*[Spray-JSON]
12
12
*[Circe]
13
-
13
+
14
14
In addition, scala-jsonapi provides out-of-the-box (un)marshallers for:
15
15
16
16
* Spray and Play
17
17
* Akka Http
18
18
19
19
## Current Status
20
-
This library is very much a work in progress, so expect its API to change.
20
+
This library is very much a work in progress, so expect its API to change.
21
21
22
22
# Setup
23
23
@@ -32,18 +32,18 @@ You also have to provide the used backend (e.g. spray-json).
32
32
The rich JSON API model is available via the following import:
33
33
34
34
import org.zalando.jsonapi.model._
35
-
35
+
36
36
The library provides serialization and deserialization of JSON API root objects to JSON using either Spray-JSON or Play-JSON. Please note that you need to explicitly add a dependency to either spray-json or play-json to your project.
scala-jsonapi provides type class `JsonapiRootEntityWriter` so that you can create a JSON API representation for your resources. The following code snippet demonstrates its usage:
72
+
scala-jsonapi provides type class `JsonapiRootObjectWriter` so that you can create a JSON API representation for your resources. The following code snippet demonstrates its usage:
73
73
74
74
import org.zalando.jsonapi
75
75
import jsonapi.Jsonapi
76
-
76
+
77
77
case class Person(name: String)
78
-
78
+
79
79
implicit val personJsonapiWriter = new JsonapiRootObjectWriter[Person] {
80
80
override def toJsonapi(person: Person) = {
81
81
???
82
82
}
83
83
}
84
-
84
+
85
85
val personRootObject: RootObject = Jsonapi.asJsonapi(Person("Boris M."))
86
86
87
-
In contrast there is a type class called `JsonapiRootEntityReader` that supports conversion from JSON API representation to your resources. To illustrate:
87
+
In contrast there is a type class called `JsonapiRootObjectReader` that supports conversion from JSON API representation to your resources. To illustrate:
88
88
89
89
import org.zalando.jsonapi
90
90
import jsonapi.Jsonapi
91
-
91
+
92
92
case class Person(name: String)
93
-
93
+
94
94
implicit val personJsonapiReader = new JsonapiRootObjectReader[Person] {
0 commit comments