diff --git a/src/library/scala/util/parsing/json/Lexer.scala b/src/library/scala/util/parsing/json/Lexer.scala index c44e29079..143871c8d 100644 --- a/src/library/scala/util/parsing/json/Lexer.scala +++ b/src/library/scala/util/parsing/json/Lexer.scala @@ -62,7 +62,7 @@ class Lexer extends StdLexical with ImplicitConversions { case None => "" } - def zero: Parser[String] = '0' ^^ toString + def zero: Parser[String] = '0' ^^ "0" def nonzero = elem("nonzero digit", d => d.isDigit && d != '0') def exponent = elem("exponent character", d => d == 'e' || d == 'E') def sign = elem("sign character", d => d == '-' || d == '+') diff --git a/test/files/run/json.check b/test/files/run/json.check index a6495477a..a73562422 100644 --- a/test/files/run/json.check +++ b/test/files/run/json.check @@ -2,6 +2,7 @@ Some(List((name,value))) Some(List((name,va1ue))) Some(List((name,List((name1,va1ue1), (name2,va1ue2))))) Some(List((name,"))) +Some(List((age,0.0))) Some(List((firstName,John), (lastName,Smith), (address,List((streetAddress,21 2nd Street), (city,New York), (state,NY), (postalCode,10021.0))), (phoneNumbers,List(212 732-1234, 646 123-4567)))) diff --git a/test/files/run/json.scala b/test/files/run/json.scala index 3b27665b5..2e7ee4aa4 100644 --- a/test/files/run/json.scala +++ b/test/files/run/json.scala @@ -8,6 +8,7 @@ object Test extends Application { printJSON("{\"name\": \"va1ue\"}") // ticket #136 printJSON("{\"name\": { \"name1\": \"va1ue1\", \"name2\": \"va1ue2\" } }") printJSON("{\"name\": \"\\u0022\"}") + printJSON("{\"age\": 0}") println // from http://en.wikipedia.org/wiki/JSON