Skip to content

Commit

Permalink
Add documentation for JsonParserSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudolph committed Nov 8, 2018
1 parent 21a3468 commit 62520d7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.markdown
Expand Up @@ -70,7 +70,6 @@ In order to make steps 3 and 4 work for an object of type `T` you need to bring
provide `JsonFormat[T]` instances for `T` and all types used by `T` (directly or indirectly).
The way you normally do this is via a "JsonProtocol".


### JsonProtocol

_spray-json_ uses [SJSON]s Scala-idiomatic type-class-based approach to connect an existing type `T` with the logic how
Expand Down Expand Up @@ -293,6 +292,21 @@ picked up by `SprayJsonSupport`. To get back a `RootJsonFormat` just wrap the co
call to `rootFormat`.


### Customizing Parser Settings

The parser can be customized by providing a custom instance of `JsonParserSettings` to `JsonParser.apply` or
`String.parseJson`:

```scala
val customSettings =
JsonParserSettings.default
.withMaxDepth(100)
.withMaxNumberCharacters(20)
val jsValue = JsonParser(jsonString, customSettings)
// or
val jsValue = jsonString.parseJson(customSettings)
```

### Credits

Most of type-class (de)serialization code is nothing but a polished copy of what **Debasish Ghosh** made available
Expand Down

0 comments on commit 62520d7

Please sign in to comment.