Skip to content

Commit 5d6736c

Browse files
committed
Update README.md
1 parent 871b381 commit 5d6736c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ To use the Scala Module in Jackson, simply register it with the
4040
ObjectMapper instance:
4141

4242
```scala
43+
// With 2.10 and later
44+
val mapper = JsonMapper.builder()
45+
.addModule(DefaultScalaModule)
46+
.build()
47+
48+
// versions before 2.10 (also support for later 2.x but not 3.0)
4349
val mapper = new ObjectMapper()
4450
mapper.registerModule(DefaultScalaModule)
4551
```
@@ -50,11 +56,12 @@ the component traits can be included individually:
5056

5157
```scala
5258
val module = new OptionModule with TupleModule {}
53-
val mapper = new ObjectMapper()
54-
mapper.registerModule(module)
59+
val mapper = JsonMapper.builder()
60+
.addModule(module)
61+
.build()
5562
```
5663

57-
You can also mixin `ScalaObjectMapper` (experimental) to get rich wrappers that automatically
64+
You can also mixin `ScalaObjectMapper` to get rich wrappers that automatically
5865
convert scala manifests directly into TypeReferences for Jackson to use:
5966
```scala
6067
val mapper = new ObjectMapper() with ScalaObjectMapper

0 commit comments

Comments
 (0)