Jma — 29-May-2014/10:29:52-7:00
@Nick:
Using this json to rebol converter (http://www.ross-gill.com/page/JSON_and_REBOL), can you do an example on how to parse values returned from this json string (http://api.jamendo.com/get2/id+name+url+image+artist_name/album/jsonpretty/?n=50&order=ratingweek_desc) ?
thanks!
Chris — 30-May-2014/14:25:58-7:00
Rebol 2:
do http://reb4.me/r/altjson
result: load-json http://api.jamendo.com/get2/id+name+url+image+artist_name/album/jsonpretty/?n=50&order=ratingweek_desc
foreach item result [print item/name]
Rebol 3 is similar:
do http://reb4.me/r3/altjson
result: load-json to string! read http://.....
(the 'to string! read' part is a workaround for a bug in the current version of R3 AltJson)
You can DO AltJson in place--convenient for prototyping--though I'd recommend downloading it and containing it in your project folder and DOing it locally:
write %altjson.r read http://reb4.me/r/altjson
Then:
do %altjson.r
Jma — 31-May-2014/8:42:48-7:00
@Chris:
If I do "probe type? result" on this other one:
result: load-json http://www.rai.tv/dl/portale/html/palinsesti/replaytv/static/RaiUno_2014_05_28.html
it says that it's of type "object"; how can I parse it ?
Endo — 12-Jul-2014/16:56:04-7:00
load-json converts a json string to an object, you can't parse an object. If you need to parse a json string then you need to parse without loading it. Check the source of load-json function it parses json strings to build objects.
Chris — 13-Jul-2014/5:44:49-7:00
If you need to parse the results, you can use LOAD-JSON/FLAT. This refinement replaces objects with TAG-VALUE paired blocks.