@@ -20,8 +20,7 @@ as depicted in this diagram:
2020### Installation
2121
2222_ spray-json_ is available from maven central.
23-
24- Latest release: [ ![ Maven Central] ( https://maven-badges.herokuapp.com/maven-central/io.spray/spray-json_2.12/badge.svg )] ( https://maven-badges.herokuapp.com/maven-central/io.spray/spray-json_2.12 )
23+ The latest release is ` 1.3.3 ` and is built against Scala 2.10.x, 2.11.x, and 2.12.x.
2524
2625If you use SBT you can include _ spray-json_ in your project with
2726
@@ -42,25 +41,26 @@ import DefaultJsonProtocol._ // if you don't supply your own Protocol (see below
4241and do one or more of the following:
4342
4443* Parse a JSON string into its Abstract Syntax Tree (AST) representation
45-
44+
4645 ``` scala
4746 val source = """ { "some": "JSON source" }"""
4847 val jsonAst = source.parseJson // or JsonParser(source)
4948 ```
50-
49+
5150* Print a JSON AST back to a String using either the `CompactPrinter` or the `PrettyPrinter`
52-
51+
5352 ```scala
5453 val json = jsonAst.prettyPrint // or .compactPrint
5554 ```
5655
57- * Convert any Scala object to a JSON AST using the `toJson` extension method
56+ * Convert any Scala object to a JSON AST using the pimped `toJson` method
57+
5858 ```scala
5959 val jsonAst = List (1 , 2 , 3 ).toJson
6060 ```
61-
61+
6262* Convert a JSON AST to a Scala object with the `convertTo` method
63-
63+
6464 ```scala
6565 val myObject = jsonAst.convertTo[MyObjectType ]
6666 ```
@@ -243,38 +243,6 @@ object MyJsonProtocol extends DefaultJsonProtocol {
243243This is a bit more verbose in its definition and the resulting JSON but transports the field semantics over to the
244244JSON side. Note that this is the approach _ spray-json_ uses for case classes.
245245
246- ### Providing JsonFormats for unboxed types
247-
248- A value class
249-
250- ``` scala
251- case class PhoneNumber (value : String ) extends AnyVal
252- val num = PhoneNumber (" +1 212 555 1111" )
253- ```
254-
255- or a class with multiple members
256-
257- ``` scala
258- case class Money (currency : String , amount : BigDecimal )
259- val bal = Money (" USD" , 100 )
260- ```
261-
262- can be handled as above with ` jsonFormatX ` , etc.
263- It may be preferable, however, to serialize such instances without object boxing:
264- as ` "USD 100" ` instead of ` {"currency":"USD","amount":100} ` .
265- This requires explicit (de)serialization logic:
266-
267- ``` scala
268- implicit object MoneyFormat extends JsonFormat [Money ] {
269- val fmt = """ ([A-Z]{3}) ([0-9.]+)""" .r
270- def write (m : Money ) = JsString (s " ${m.currency} ${m.amount}" )
271- def read (json : JsValue ) = json match {
272- case JsString (fmt(c, a)) => Money (c, BigDecimal (a))
273- case _ => deserializationError(" String expected" )
274- }
275- }
276- ```
277-
278246
279247### JsonFormat vs. RootJsonFormat
280248
@@ -329,22 +297,20 @@ _spray-json_ is licensed under [APL 2.0].
329297
330298### Mailing list
331299
332- Spray-json is in primarily "maintanance mode", as it contains the basic functionality it is meant to deliver.
333- If you have any questions about it though, please open issues on this repository.
334-
300+ Please use the [ spray-user] mailing list if you have any questions.
335301
336- ### Maintanance mode
337302
338- _ spray-json_ is largely considered feature-complete for the basic functionality it provides.
339- It is currently maintained by the Akka team at Lightbend.
303+ ### Patch Policy
340304
341305Feedback and contributions to the project, no matter what kind, are always very welcome.
342-
306+ However, patches can only be accepted from their original author.
343307Along with any patches, please state that the patch is your original work and that you license the work to the
344308_ spray-json_ project under the project’s open source license.
345309
346310
347311 [ JSON ] : http://json.org
312+ [ repo.spray.io ] : http://repo.spray.io
348313 [ SJSON ] : https://github.com/debasishg/sjson
349- [ Databinder-Dispatch ] : https://github.com/dispatch/classic
314+ [ Databinder-Dispatch ] : https://github.com/n8han/Databinder-Dispatch
350315 [ APL 2.0 ] : http://www.apache.org/licenses/LICENSE-2.0
316+ [ spray-user ] : http://groups.google.com/group/spray-user
0 commit comments