diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2018-11-08 14:13:38 +0100 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2018-11-08 14:13:38 +0100 |
commit | 62520d75a40a140130a8dac7c387ac7cf0c69e80 (patch) | |
tree | 5e1355c3e0810d961ae0b518cf2cdeaa637ccdc8 | |
parent | 21a3468cf229d9cdb68a683da8c98a9dd8f4b553 (diff) | |
download | spray-json-62520d75a40a140130a8dac7c387ac7cf0c69e80.tar.gz spray-json-62520d75a40a140130a8dac7c387ac7cf0c69e80.tar.bz2 spray-json-62520d75a40a140130a8dac7c387ac7cf0c69e80.zip |
Add documentation for JsonParserSettings
-rw-r--r-- | README.markdown | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown index 458627e..549f520 100644 --- a/README.markdown +++ b/README.markdown @@ -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 @@ -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 |