I like that.
But still hate JSON ;-)

2009/11/20 Joni Freeman <freeman.j...@gmail.com>:
> Hi,
>
> There's several ways to get values from JSON.
>
> 1. Use LINQ style query comprehension:
>
> for { JField("bar", JInt(x)) <- json } yield x
>
> 2. Extract values with case classes
>
> implicit val formats = net.liftweb.json.DefaultFormats
> case class Foo(foo: Bar)
> case class Bar(bar: Int)
> json.extract[Foo]
>
> 3. XPath style
>
> val JField("bar", JInt(x)) = json \ "foo" \ "bar"
>
> Cheers Joni
>
> On 19 marras, 22:20, harryh <har...@gmail.com> wrote:
>> Is there a basic intro to lift-json floating around anywhere?  I'm
>> having a bit of trouble getting started with a couple basic things.
>> For example if a have a JObject that corresponds to:
>>
>> {
>>   "foo" : {
>>     "bar" : 999
>>   }
>>
>> }
>>
>> How do I get the 999 (as an int) out of the JObject?  I'm sure this is
>> simple, just a bit confused on the basics.
>>
>> -harryh
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to 
> liftweb+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/liftweb?hl=.
>
>
>



-- 
Jonas Bonér

twitter: @jboner
blog:    http://jonasboner.com
work:   http://scalablesolutions.se
code:   http://github.com/jboner
code:   http://akkasource.org
also:    http://letitcrash.com

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=.


Reply via email to