Skip to content

Commit 8dc25d6

Browse files
committed
Merge pull request #115 from rafael/patch-1
Update README.markdown
2 parents 6b1aa04 + c586897 commit 8dc25d6

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

README.markdown

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,29 @@ import DefaultJsonProtocol._ // !!! IMPORTANT, else `convertTo` and `toJson` won
4646
and do one or more of the following:
4747

4848
1. Parse a JSON string into its Abstract Syntax Tree (AST) representation
49-
```scala
50-
val source = """{ "some": "JSON source" }"""
51-
val jsonAst = source.parseJson // or JsonParser(source)
52-
```
53-
49+
50+
```scala
51+
val source = """{ "some": "JSON source" }"""
52+
val jsonAst = source.parseJson // or JsonParser(source)
53+
```
54+
5455
2. Print a JSON AST back to a String using either the `CompactPrinter` or the `PrettyPrinter`
55-
```scala
56-
val json = jsonAst.prettyPrint // or .compactPrint
57-
```
58-
56+
57+
```scala
58+
val json = jsonAst.prettyPrint // or .compactPrint
59+
```
60+
5961
3. Convert any Scala object to a JSON AST using the pimped `toJson` method
60-
```scala
61-
val jsonAst = List(1, 2, 3).toJson
62-
```
63-
62+
63+
```scala
64+
val jsonAst = List(1, 2, 3).toJson
65+
```
66+
6467
4. Convert a JSON AST to a Scala object with the `convertTo` method
65-
```scala
66-
val myObject = jsonAst.convertTo[MyObjectType]
67-
```
68+
69+
```scala
70+
val myObject = jsonAst.convertTo[MyObjectType]
71+
```
6872

6973
In order to make steps 3 and 4 work for an object of type `T` you need to bring implicit values in scope that
7074
provide `JsonFormat[T]` instances for `T` and all types used by `T` (directly or indirectly).

0 commit comments

Comments
 (0)