How to use the JSON Decode text

2,192 views
Skip to first unread message

gines.pl...@gmail.com

unread,
Jan 17, 2014, 3:34:16 PM1/17/14
to mitappinv...@googlegroups.com
Hi there,

I am learning to develop using the ai2 but got stuck when getting a JSON fro the google fusion tables query.

I dont know how to parse the JSON, was trying the JsonTextDecode, I am getting:

{
"kind": "fusiontables#sqlresponse",
"columns": [
"user"
],
"rows": [
[
"gines"
]
]
}

https://www.googleapis.com/fusiontables/v1/query?sql=SELECT%20user%20FROM%201aOs8GdfGVv2eVcqDN4c45swIBafwseAX1s7B15s%20GROUP%20BY%20user&key=AIzaSyDVmfDQBB3q8SnBeSgbaJdi21z11nxxjGE

I would like to use the data "gines" as a text label but no clue how to do it.

Enclosed you can see how the project is structured.

Many thanks,

Gines

Windows 7 - 64 Bits
Chrome 32.0.1700.76 m
Ai2 Built: January 9 2014 Version: nb119
Use Companion: 2.11ai2zx1

.

Captura de tela 2014-01-17 18.32.35.png

M. Hossein Amerkashi

unread,
Jan 17, 2014, 3:36:39 PM1/17/14
to gines.pl...@gmail.com, mitappinv...@googlegroups.com
Here is a useful link that converts your json to visual format. Use it to understand your data:



--
You received this message because you are subscribed to the Google Groups "MIT App Inventor Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mitappinventort...@googlegroups.com.
To post to this group, send email to mitappinv...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mitappinventortest/08d6ed05-2251-449e-a43c-2e709aa9f34d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

gines.pl...@gmail.com

unread,
Jan 17, 2014, 3:57:14 PM1/17/14
to mitappinv...@googlegroups.com, gines.pl...@gmail.com
Hi Hossein, thanks so much for the fast reply!

I know how to translate the Json when using PHP, Phyton, but struggling on ai2, I am felling kind of ingested (total lack of knowledge on it) :(

So how would I take out the data from the rows field?

Tks,

Gines

Hal Abelson

unread,
Jan 18, 2014, 1:14:34 AM1/18/14
to mitappinv...@googlegroups.com, gines.pl...@gmail.com
For an example like the one you asked about:

{

 "kind": "fusiontables#sqlresponse",
 "columns": [
  "user"
 ],
 "rows": [
  [
   "gines"
  ]
 ]
}

Use JSON text decode, which will transform that into a list of pairs.  Then use "lookup in pairs" on the results, using the key  "rows"
> To unsubscribe from this group and stop receiving emails from it, send an email to mitappinventortest+unsub...@googlegroups.com.

Taifun

unread,
Jan 18, 2014, 7:23:32 AM1/18/14
to mitappinv...@googlegroups.com, gines.pl...@gmail.com
alternatively you can use the parameter &alt=csv to get the data in csv format
Reply all
Reply to author
Forward
0 new messages