Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Parse NaN value as Double.NaN #1307

Closed
wants to merge 1 commit into from

2 participants

@david206

Since NaN values are supported in serialization to JSON, we decided to add support for deserialization as well, even though it's not part of the official JSON spec.

@david206 david206 Parse NaN value as Double.NaN
Since NaN values are supported in serialization to JSON, we decided to add support for deserialization as well, even though it's not part of the official JSON spec.
a21c0fd
@Shadowfiend
Owner

Note that we can't accept pull requests. See http://liftweb.net/community for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. @david206

    Parse NaN value as Double.NaN

    david206 authored
    Since NaN values are supported in serialization to JSON, we decided to add support for deserialization as well, even though it's not part of the official JSON spec.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 core/json/src/main/scala/net/liftweb/json/JsonParser.scala
View
6 core/json/src/main/scala/net/liftweb/json/JsonParser.scala
@@ -296,6 +296,12 @@ object JsonParser {
return NullVal
}
fail("expected null")
+ case 'N' =>
+ fieldNameMode = true
+ if (buf.next == 'a' && buf.next == 'N') {
+ return DoubleVal(Double.NaN)
+ }
+ fail("expected null")
case ':' =>
if (blocks.peek == ARRAY) fail("Colon in an invalid position")
fieldNameMode = false
Something went wrong with that request. Please try again.