On review board: http://reviewboard.liftweb.net/r/131/
I did run across another infelicity when writing the test -- apparently
JsonParser crashes when given a scalar value, as opposed to an array or object:
scala> parse("\"foobar\"")
net.liftweb.json.JsonParser$ParseException: unexpected null
Near: "foobar
at net.liftweb.json.JsonParser$Parser.fail(JsonParser.scala:166)
at net.liftweb.json.JsonParser$ValStack.peek(JsonParser.scala:153)
at net.liftweb.json.JsonParser$.newValue$1(JsonParser.scala:110)
at net.liftweb.json.JsonParser$.parse0(JsonParser.scala:125)
at net.liftweb.json.JsonParser$.parse(JsonParser.s...
I'm not sure if it should work, but even if it shouldn't support that the error
case should probably give a better message. Joni/et al?
-Ross
On Nov 30, 2009, at 8:33 PM, harryh wrote:
> Done:
>
> http://github.com/dpp/liftweb/issues/#issue/214
>
> On Nov 30, 6:33 pm, Ross Mellgren <[email protected]> wrote:
>> If you file an issue on github I'll write up a patch for you tonight.
>>
>> -Ross
>>
>> On Nov 30, 2009, at 6:30 PM, harryh wrote:
>>
>>> Yes, what Ross said. Further, taking a look at JsonParser.scala the
>>> bug appears to be on line ~202 where there are a couple of missing
>>> escape sequences: \/ as well as \f.
>>
>>> -harryh
>>
>>> On Nov 30, 6:20 pm, Ross Mellgren <[email protected]> wrote:
>>>> He's double escaping so that scala's string interpretation will put a
>>>> raw \ in there, so that it's an escaped forward slash (\/) to the
>>>> JSON
>>>> parson, as I understand it. The output should be either invalid
>>>> escape
>>>> or forward slash, but not backslash unless the input was \\.
>>
>>>> -Ross
>>
>>>> On Nov 30, 2009, at 6:18 PM, Peter Robinett wrote:
>>
>>>>> Harry, I think you're double-escaping the slash. This works:
>>>>> scala> import net.liftweb.json._
>>>>> scala> val s1 = "{ \"id\": \"America/New_York\" }"
>>>>> s1: java.lang.String = { "id": "America/New_York" }
>>
>>>>> scala> JsonParser.parse(s1)
>>>>> res0: net.liftweb.json.JsonAST.JValue = JObject(List(JField
>>>>> (id,JString
>>>>> (America/New_York))))
>>
>>>>> Peter Robinett
>>
>>>>> On Nov 30, 2:16 pm, harryh <[email protected]> wrote:
>>>>>> scala> import net.liftweb.json._
>>>>>> scala> val s2 = "{ \"id\": \"America\\/New_York\" }"
>>>>>> s2: java.lang.String = { "id": "America\/New_York" }
>>
>>>>>> scala> JsonParser.parse(s2)
>>>>>> res1: net.liftweb.json.JsonAST.JValue = JObject(List(JField
>>>>>> (id,JString
>>>>>> (America\New_York))))
>>
>>>>>> It should be America/New_York but for some reason getting a \
>>>>>> instead
>>>>>> of a /
>>
>>>>>> -harryh
>>
>>>>> --
>>
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Lift" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]
>>>>> .
>>>>> For more options, visit this group
>>>>> athttp://groups.google.com/group/liftweb?hl=en
>>>>> .
>>
>>> --
>>
>>> You received this message because you are subscribed to the Google
>>> Groups "Lift" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> .
>>> For more options, visit this group
>>> athttp://groups.google.com/group/liftweb?hl=en
>>> .
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.