|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
JsonResponse with non string valuesHello guys, I have the following code working ok: JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> newUser.id.toString)) The returned JSON message looks like the following: {"Op": 5, "e": 0, "id":"123455"} I would like the message to be like this: {"Op": 5, "e": 0, "id": 123455} If I write the line like this: JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> newUser.id) I receive a compilation error saying: found : Long required: net.liftweb.http.js.JsExp with net.liftweb.util.Bindable How can I return the long value without converting it to string? Thanks in advance, GA --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@... To unsubscribe from this group, send email to liftweb+unsubscribe@... For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: JsonResponse with non string valuesBring the numToJsExp implicit into scope -- import net.liftweb.http.js.JE.numToJsExp -Ross On Nov 9, 2009, at 12:22 PM, GA wrote: > > Hello guys, > > I have the following code working ok: > > JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> > newUser.id.toString)) > > The returned JSON message looks like the following: > > {"Op": 5, "e": 0, "id":"123455"} > > I would like the message to be like this: > > {"Op": 5, "e": 0, "id": 123455} > > If I write the line like this: > > JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> > newUser.id) > > I receive a compilation error saying: > > found : Long > required: net.liftweb.http.js.JsExp with net.liftweb.util.Bindable > > How can I return the long value without converting it to string? > > Thanks in advance, > > GA > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@... To unsubscribe from this group, send email to liftweb+unsubscribe@... For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: JsonResponse with non string valuesThanks for the answer. This line does the trick: newUser.id.asJsExp . It returns a type net.liftweb.http.js.JE.numToJsExp. GA On Nov 9, 2009, at 6:31 PM, Ross Mellgren wrote: > > Bring the numToJsExp implicit into scope -- import > net.liftweb.http.js.JE.numToJsExp > > -Ross > > On Nov 9, 2009, at 12:22 PM, GA wrote: > >> >> Hello guys, >> >> I have the following code working ok: >> >> JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> >> newUser.id.toString)) >> >> The returned JSON message looks like the following: >> >> {"Op": 5, "e": 0, "id":"123455"} >> >> I would like the message to be like this: >> >> {"Op": 5, "e": 0, "id": 123455} >> >> If I write the line like this: >> >> JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> >> newUser.id) >> >> I receive a compilation error saying: >> >> found : Long >> required: net.liftweb.http.js.JsExp with net.liftweb.util.Bindable >> >> How can I return the long value without converting it to string? >> >> Thanks in advance, >> >> GA >> >> >>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@... To unsubscribe from this group, send email to liftweb+unsubscribe@... For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |