diff options
author | Johannes Rudolph <johannes.rudolph@gmail.com> | 2018-11-08 14:13:05 +0100 |
---|---|---|
committer | Johannes Rudolph <johannes.rudolph@gmail.com> | 2018-11-08 14:13:05 +0100 |
commit | 21a3468cf229d9cdb68a683da8c98a9dd8f4b553 (patch) | |
tree | d33d396245071697363fd95d5b29bb735bad388d | |
parent | 08216428ebc1d5af837543116811b4d70caa5fb3 (diff) | |
download | spray-json-21a3468cf229d9cdb68a683da8c98a9dd8f4b553.tar.gz spray-json-21a3468cf229d9cdb68a683da8c98a9dd8f4b553.tar.bz2 spray-json-21a3468cf229d9cdb68a683da8c98a9dd8f4b553.zip |
Seal JsonParserSetting trait
It shouldn't be extended but be used as shown.
-rw-r--r-- | src/main/scala/spray/json/JsonParserSettings.scala | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/scala/spray/json/JsonParserSettings.scala b/src/main/scala/spray/json/JsonParserSettings.scala index b82c47d..8c76b0a 100644 --- a/src/main/scala/spray/json/JsonParserSettings.scala +++ b/src/main/scala/spray/json/JsonParserSettings.scala @@ -1,6 +1,22 @@ package spray.json -trait JsonParserSettings { +/** + * Allows to customize settings for the JSON parser. + * + * Use it like this: + * + * ``` + * val customSettings = + * JsonParserSettings.default + * .withMaxDepth(100) + * .withMaxNumberCharacters(20) + * + * JsonParser(jsonString, customSettings) + * // or + * jsonString.parseJson(customSettings) + * ``` + */ +sealed trait JsonParserSettings { /** * The JsonParser uses recursive decent parsing that keeps intermediate values on the stack. To prevent * StackOverflowExceptions a limit is enforced on the depth of the parsed JSON structure. |