summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorRafael Chacon <rafaelchacon@gmail.com>2014-08-08 11:34:20 -0700
committerRafael Chacon <rafaelchacon@gmail.com>2014-08-08 11:34:20 -0700
commitc58689713ef124d37078d55045a0178bdd098e20 (patch)
treeba0a2f6960b2866c20ffed33ea4e9da0fcc6517e /README.markdown
parent6b1aa0449d4eee0b6b28f1025744f083db4ea800 (diff)
downloadspray-json-c58689713ef124d37078d55045a0178bdd098e20.tar.gz
spray-json-c58689713ef124d37078d55045a0178bdd098e20.tar.bz2
spray-json-c58689713ef124d37078d55045a0178bdd098e20.zip
Update README.markdown
* Fix small issue with markdown so list enumeration works.
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown36
1 files changed, 20 insertions, 16 deletions
diff --git a/README.markdown b/README.markdown
index 1724497..c10578c 100644
--- a/README.markdown
+++ b/README.markdown
@@ -46,25 +46,29 @@ import DefaultJsonProtocol._ // !!! IMPORTANT, else `convertTo` and `toJson` won
and do one or more of the following:
1. Parse a JSON string into its Abstract Syntax Tree (AST) representation
-```scala
-val source = """{ "some": "JSON source" }"""
-val jsonAst = source.parseJson // or JsonParser(source)
-```
-
+
+ ```scala
+ val source = """{ "some": "JSON source" }"""
+ val jsonAst = source.parseJson // or JsonParser(source)
+ ```
+
2. Print a JSON AST back to a String using either the `CompactPrinter` or the `PrettyPrinter`
-```scala
-val json = jsonAst.prettyPrint // or .compactPrint
-```
-
+
+ ```scala
+ val json = jsonAst.prettyPrint // or .compactPrint
+ ```
+
3. Convert any Scala object to a JSON AST using the pimped `toJson` method
-```scala
-val jsonAst = List(1, 2, 3).toJson
-```
-
+
+ ```scala
+ val jsonAst = List(1, 2, 3).toJson
+ ```
+
4. Convert a JSON AST to a Scala object with the `convertTo` method
-```scala
-val myObject = jsonAst.convertTo[MyObjectType]
-```
+
+ ```scala
+ val myObject = jsonAst.convertTo[MyObjectType]
+ ```
In order to make steps 3 and 4 work for an object of type `T` you need to bring implicit values in scope that
provide `JsonFormat[T]` instances for `T` and all types used by `T` (directly or indirectly).