diff options
author | Konrad Malawski <konrad.malawski@project13.pl> | 2016-04-22 15:13:48 +0200 |
---|---|---|
committer | Konrad Malawski <konrad.malawski@project13.pl> | 2016-04-22 15:13:48 +0200 |
commit | aae2c6ef9e33e204aa4040689465804150ec226b (patch) | |
tree | 15eb41471d523aad67f6daf07827845214af866d /src/main/scala/spray | |
parent | 4fbde3a833cb122c71aaf85a1b3bbd31e130cb62 (diff) | |
download | spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.tar.gz spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.tar.bz2 spray-json-aae2c6ef9e33e204aa4040689465804150ec226b.zip |
+#182 allows BigInt/BigDecimal to be obtained from JsStrings
Diffstat (limited to 'src/main/scala/spray')
-rw-r--r-- | src/main/scala/spray/json/BasicFormats.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/scala/spray/json/BasicFormats.scala b/src/main/scala/spray/json/BasicFormats.scala index 96751f6..65b9ecb 100644 --- a/src/main/scala/spray/json/BasicFormats.scala +++ b/src/main/scala/spray/json/BasicFormats.scala @@ -79,6 +79,7 @@ trait BasicFormats { } def read(value: JsValue) = value match { case JsNumber(x) => x + case JsString(x) => BigDecimal(x) case x => deserializationError("Expected BigDecimal as JsNumber, but got " + x) } } @@ -90,6 +91,7 @@ trait BasicFormats { } def read(value: JsValue) = value match { case JsNumber(x) => x.toBigInt + case JsString(x) => BigInt(x) case x => deserializationError("Expected BigInt as JsNumber, but got " + x) } } |