json structure

7 views
Skip to first unread message

MrIndia

unread,
Jul 13, 2010, 3:06:30 PM7/13/10
to Jaql Users
I have stream of json objects. I like the following structure:

{
"key1" : "val",
"key2" : -1,
"key3" : 10,
"key4" : [
{
"key5" : "SETUP",
"key6" : -1,
"key7" : [
{
"key8" : -1,
}]
}
}
{
"key1" : "val",
"key2" : -1,
"key3" : 1024,
"key4" : [
{
"key5" : "SETUP",
"key6" : -1,
"key7" : [
{
"key8" : -1,
}]
}
}
....

I have these questions:
1. I am wondering if jaql can handle this structure? I got it to work
with array but can it work with stream of json objects like i shown
above?

2. How to query for key8 in jaql?


Thanks in anticipation,
Bharath

Markus

unread,
Jul 15, 2010, 9:30:06 AM7/15/10
to Jaql Users
Hey Bharath,

I am only another user, but let me tell you at least some things.
First of all, may it be that you forgot the closing square bracket for
"key4"?.
Anyway, if you can comma-separate the records, and put them into an
array, JAQL will definitely be able to read this. (But that is only
the way i know, there may be others)

If alle these records would be in one array, you may access key8 like:
"array[].key4[].key7[].key8" to get all key8 values. For certain
indices you have put numbers into the brackets.
I remember a bug which prevented accessing nested records, but I think
it was fixed some time ago. Go ahead and have a try :).

I hope this was helpful,

Best regards,
Markus

Markus

unread,
Jul 15, 2010, 9:32:50 AM7/15/10
to Jaql Users
p.s. have a look at the thread "how to visit nested data?" written by
Kevin Beyer. It explains the accessing of nested records in more
detail.


Reply all
Reply to author
Forward
0 new messages