2015-10-14 1 views
0

J'envoie une demande qui renvoie les éléments suivants:Impossible d'accéder aux éléments dans la baie JSON?

{ 
    "title": "Recent Uploads", 
    "link": "http://www.flickr.com/photos/", 
    "description": "", 
    "generator": "http://www.flickr.com/", 
    "items": [ 
    { 
     "title": "Title 1", 
     "link": "http://www.flickr.com/photos/123" 
    } ] 
} 

Pourtant, lorsque je tente d'accéder à des choses à l'intérieur, je reçois une valeur « non défini »:

xml.onreadystatechange = function() { 
    if (xml.readyState == 4 && xml.status == 200) { 
     var rsp = xml.rspTxt 
     console.log(rsp.title); 
    } 
} 

Qu'est-ce que je fais mal? Autant que je sache, cela devrait fonctionner ...

EDIT: Fiddle.

+0

vérifiez si console.log (rsp [0] .title); enregistre toutes les données – wayzz

+0

@wayzz Non, toujours indéfini. Pas un problème d'index –

+0

essayez var rsp = JSON.parse (xml.rspTxt) –

Répondre

1

Il est parce que votre JSON est pas un JSON valide du tout ..

var test = { 
    "title": "Recent Uploads", 
    "link": "http://www.flickr.com/photos/", 
    "description": "", 
    "generator": "http://www.flickr.com/", 
    "items": { 

     "title": "Title 1", 
     "link": "http://www.flickr.com/photos/123" 
    } 
}; 

console.log(test.title); 

Cela fonctionne bien et les résultats dans « Envois récents » dans la console. Vous ne pouvez pas avoir '[' là et ',' à la fin.

+0

Heureux que j'ai contribué en aidant @Anik Islam Abni avec sa réponse –

+0

Salut le JSON est correct, j'ai mis à jour ma question avec un Fiddle –

0

Comme d'autres personnes l'ont déjà indiqué, la réponse JSON obtenue à partir de cet appel n'est pas valide.

{ 
    "title": "Recent Uploads tagged potato", 
    "link": "https://www.flickr.com/photos/tags/potato/", 
    "description": "", 
    "modified": "2015-10-14T09:17:25Z", 
    "generator": "https://www.flickr.com/", 
    "items": [ 
    { 
     "title": "French fries", 
     "link": "https://www.flickr.com/photos/[email protected]/22159555595/", 
     "media": {"m":"https://farm1.staticflickr.com/758/22159555595_0a1ba32e44_m.jpg"}, 
     "date_taken": "2008-06-18T16:50:34-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">Chulpa<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/22159555595/\" title=\"French fries\"><img src=\"https://farm1.staticflickr.com/758/22159555595_0a1ba32e44_m.jpg\" width=\"240\" height=\"160\" alt=\"French fries\" /><\/a><\/p> <p>Heap of crisp French fries - detail<\/p>", 
     "published": "2015-10-14T09:17:25Z", 
     "author": "[email protected] (Chulpa)", 
     "author_id": "[email protected]", 
     "tags": "hot detail macro closeup studio fastfood tasty sidedish frenchfries chips crisp potato snack junkfood takeaway portion sliced popular unhealthy baked roasted deepfried fattening accompaniment pommefrites takeoutfood" 
    }, 
    { 
     "title": "potatowedges", 
     "link": "https://www.flickr.com/photos/[email protected]/22131498326/", 
     "media": {"m":"https://farm1.staticflickr.com/700/22131498326_05d9f67dac_m.jpg"}, 
     "date_taken": "2015-10-14T00:23:48-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">amandahar<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/22131498326/\" title=\"potatowedges\"><img src=\"https://farm1.staticflickr.com/700/22131498326_05d9f67dac_m.jpg\" width=\"240\" height=\"240\" alt=\"potatowedges\" /><\/a><\/p> ", 
     "published": "2015-10-14T07:23:48Z", 
     "author": "[email protected] (amandahar)", 
     "author_id": "[email protected]", 
     "tags": "potato potatowedges" 
    }, 
    { 
     "title": "Shadows and Potato van in Preston", 
     "link": "https://www.flickr.com/photos/tonyworrall/21968606450/", 
     "media": {"m":"https://farm1.staticflickr.com/758/21968606450_3a9c70e5bc_m.jpg"}, 
     "date_taken": "2015-09-30T13:12:20-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/tonyworrall/\">Tony Worrall Foto<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/tonyworrall/21968606450/\" title=\"Shadows and Potato van in Preston\"><img src=\"https://farm1.staticflickr.com/758/21968606450_3a9c70e5bc_m.jpg\" width=\"240\" height=\"171\" alt=\"Shadows and Potato van in Preston\" /><\/a><\/p> <p>© 2015 Tony Worrall<\/p>", 
     "published": "2015-10-14T06:34:58Z", 
     "author": "[email protected] (Tony Worrall Foto)", 
     "author_id": "[email protected]", 
     "tags": "county street uk england people urban food lunch stream tour shadows open place northwest unitedkingdom candid country north visit location lancashire eat potato queue area buy preston van northern update streetfood attraction lancs welovethenorth :copyright:2015tonyworrall" 
    }, 
    { 
     "title": "thực phẩm giàu dinh dưỡng", 
     "link": "https://www.flickr.com/photos/[email protected]/22156604725/", 
     "media": {"m":"https://farm6.staticflickr.com/5751/22156604725_882ca5642d_m.jpg"}, 
     "date_taken": "2012-08-06T16:59:38-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">hoaithuong0115<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/22156604725/\" title=\"thực phẩm giàu dinh dưỡng\"><img src=\"https://farm6.staticflickr.com/5751/22156604725_882ca5642d_m.jpg\" width=\"240\" height=\"160\" alt=\"thực phẩm giàu dinh dưỡng\" /><\/a><\/p> <p>Xem: <a href=\"http://emdep.vn/thuc-don-giam-can-s275.htm\" rel=\"nofollow\">emdep.vn/thuc-don-giam-can-s275.htm<\/a><\/p>", 
     "published": "2015-10-14T06:25:03Z", 
     "author": "[email protected] (hoaithuong0115)", 
     "author_id": "[email protected]", 
     "tags": "red food orange green apple mushroom fruits vegetables tomato pepper healthy natural display market sweet tomatoes olive banana supermarket lettuce potato pineapple asparagus crop snack carrot pear cauliflower garlic produce onion feed organic grocery fiber eats edible goodies eatable groceries arrangement grape combination nutrition lowfat nourishment nutrients nonfat provision lowcalorie nutriment" 
    }, 
    { 
     "title": "", 
     "link": "https://www.flickr.com/photos/underthetuliptree/21959671820/", 
     "media": {"m":"https://farm6.staticflickr.com/5803/21959671820_f60c0cd98f_m.jpg"}, 
     "date_taken": "2012-07-12T14:22:38-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/underthetuliptree/\">julianna smith<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/underthetuliptree/21959671820/\" title=\"\"><img src=\"https://farm6.staticflickr.com/5803/21959671820_f60c0cd98f_m.jpg\" width=\"160\" height=\"240\" alt=\"\" /><\/a><\/p> <p>Potato cakes with onions and spinach<\/p>", 
     "published": "2015-10-13T22:42:18Z", 
     "author": "[email protected] (julianna smith)", 
     "author_id": "[email protected]", 
     "tags": "food cakes dinner vegan smith potato julianna" 
    }, 
    { 
     "title": "Prague 14", 
     "link": "https://www.flickr.com/photos/[email protected]/22106050326/", 
     "media": {"m":"https://farm6.staticflickr.com/5636/22106050326_67983e253b_m.jpg"}, 
     "date_taken": "2015-10-04T14:44:43-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">MichaelWard82<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/22106050326/\" title=\"Prague 14\"><img src=\"https://farm6.staticflickr.com/5636/22106050326_67983e253b_m.jpg\" width=\"240\" height=\"160\" alt=\"Prague 14\" /><\/a><\/p> ", 
     "published": "2015-10-13T10:46:54Z", 
     "author": "[email protected] (MichaelWard82)", 
     "author_id": "[email protected]", 
     "tags": "food republic czech prague potato twirl" 
    }, 
    { 
     "title": "My Dinner", 
     "link": "https://www.flickr.com/photos/sarahjdhue/21941657920/", 
     "media": {"m":"https://farm6.staticflickr.com/5701/21941657920_53387b668c_m.jpg"}, 
     "date_taken": "2015-10-11T15:17:25-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/sarahjdhue/\">SarahJDhue<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/sarahjdhue/21941657920/\" title=\"My Dinner\"><img src=\"https://farm6.staticflickr.com/5701/21941657920_53387b668c_m.jpg\" width=\"240\" height=\"181\" alt=\"My Dinner\" /><\/a><\/p> <p>Weinerschnitzel ala Holstein -Sarah J Dhue<\/p>", 
     "published": "2015-10-13T08:11:25Z", 
     "author": "[email protected] (SarahJDhue)", 
     "author_id": "[email protected]", 
     "tags": "red food pancakes dinner restaurant illinois october yum egg cellphone samsung palace il potato german ala cabbage fried dreamland applesauce holstein veal weinerschnitzel galaxys6 sarahjdhuephotos sarahjdhue" 
    }, 
    { 
     "title": "Open Faced at Old Vine Cafe", 
     "link": "https://www.flickr.com/photos/[email protected]/22136102231/", 
     "media": {"m":"https://farm6.staticflickr.com/5651/22136102231_984461d378_m.jpg"}, 
     "date_taken": "2015-09-19T22:02:02-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">deeeelish<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/22136102231/\" title=\"Open Faced at Old Vine Cafe\"><img src=\"https://farm6.staticflickr.com/5651/22136102231_984461d378_m.jpg\" width=\"240\" height=\"149\" alt=\"Open Faced at Old Vine Cafe\" /><\/a><\/p> <p>Fresh Biscuit, Chicken Sausage, Scrambled Eggs, Chipotle Gravy &amp; Queso Fresco with Potatoes <br /> <br /> Costa Mesa, CA<\/p>", 
     "published": "2015-10-13T04:30:52Z", 
     "author": "[email protected] (deeeelish)", 
     "author_id": "[email protected]", 
     "tags": "gravy potato eggs quesofresno" 
    }, 
    { 
     "title": "Omelette at Old Vine Cafe", 
     "link": "https://www.flickr.com/photos/[email protected]/21938083198/", 
     "media": {"m":"https://farm1.staticflickr.com/593/21938083198_046a230259_m.jpg"}, 
     "date_taken": "2015-09-19T22:02:47-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/[email protected]/\">deeeelish<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/[email protected]/21938083198/\" title=\"Omelette at Old Vine Cafe\"><img src=\"https://farm1.staticflickr.com/593/21938083198_046a230259_m.jpg\" width=\"240\" height=\"156\" alt=\"Omelette at Old Vine Cafe\" /><\/a><\/p> <p>Costa Mesa, CA<\/p>", 
     "published": "2015-10-13T04:30:54Z", 
     "author": "[email protected] (deeeelish)", 
     "author_id": "[email protected]", 
     "tags": "potato eggs omelette" 
    }, 
    { 
     "title": "Chicken", 
     "link": "https://www.flickr.com/photos/jorkew/22106677661/", 
     "media": {"m":"https://farm6.staticflickr.com/5710/22106677661_00d43a64bc_m.jpg"}, 
     "date_taken": "2015-09-05T00:00:00-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/jorkew/\">Jorkew<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/jorkew/22106677661/\" title=\"Chicken\"><img src=\"https://farm6.staticflickr.com/5710/22106677661_00d43a64bc_m.jpg\" width=\"160\" height=\"240\" alt=\"Chicken\" /><\/a><\/p> <p>Kodak Ektar 100<br /> Canon eos 1<br /> Canon EF 24-70mm f/2.8 L USM<br /> <br /> A few test shots from the new camera. <br /> <br /> <a href=\"http://jorkew.com/\" rel=\"nofollow\">Website<\/a> | <a href=\"http://facebook.com/jorkewphotography\" rel=\"nofollow\">Facebook<\/a><\/p>", 
     "published": "2015-10-12T20:40:00Z", 
     "author": "[email protected] (Jorkew)", 
     "author_id": "[email protected]", 
     "tags": "camera red food chicken film analog canon photography eos 1 potatoes oven kodak kip potato l produce 100 usm filmcamera 135 done canoneos f28 canonef2470mmf28lusm ef baked eos1 ektar foodphotography 2470mm analogcamera llens kodak100 filmisnotdead canoneos1 canonllens kodakektar canon2470mmf28 kodakcolorfilm canonef2470mm ektar100 canonanalogcamera staybrokeshootfilm canoneos1analog canoneos1filmcamera" 
    }, 
    { 
     "title": "Alice in Wonderland Pitstop", 
     "link": "https://www.flickr.com/photos/magicattic88/21491271583/", 
     "media": {"m":"https://farm1.staticflickr.com/746/21491271583_5113d90565_m.jpg"}, 
     "date_taken": "2015-10-07T00:00:00-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/magicattic88/\">Darling Starlings<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/magicattic88/21491271583/\" title=\"Alice in Wonderland Pitstop\"><img src=\"https://farm1.staticflickr.com/746/21491271583_5113d90565_m.jpg\" width=\"240\" height=\"240\" alt=\"Alice in Wonderland Pitstop\" /><\/a><\/p> <p>After seeing Terry Wogan in the Waterstones tent - CheltLitFest 2015 - Jue [https://www.flickr.com/photos/pyride] and I wandered around a bit - we found this lovely little Alice in Wonderland themed café on the Festival site. It called for a Penelope Pitstop of crunchy lattice chips with dips and a coffee each - yum. Just what was needed :)).<\/p>", 
     "published": "2015-10-12T16:17:19Z", 
     "author": "[email protected] (Darling Starlings)", 
     "author_id": "[email protected]", 
     "tags": "food coffee festival hearts town cafe penelope poinsettia hats literature chips potato pitstop cheltenham lattice aliceinwonderland dips imperialgardens 2015 candlebra bigteacup cheltlitfest" 
    }, 
    { 
     "title": "Giant potatomobile", 
     "link": "https://www.flickr.com/photos/asciident/22079616896/", 
     "media": {"m":"https://farm6.staticflickr.com/5765/22079616896_c1bedd0a4a_m.jpg"}, 
     "date_taken": "2015-10-04T17:10:42-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/asciident/\">asciident<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/asciident/22079616896/\" title=\"Giant potatomobile\"><img src=\"https://farm6.staticflickr.com/5765/22079616896_c1bedd0a4a_m.jpg\" width=\"240\" height=\"202\" alt=\"Giant potatomobile\" /><\/a><\/p> <p>Near Wendell, Idaho<br /> <br /> Excuse the thumb, I was in a hurry to catch the potatomobile!<\/p>", 
     "published": "2015-10-12T06:59:23Z", 
     "author": "[email protected] (asciident)", 
     "author_id": "[email protected]", 
     "tags": "idaho potato wendell potatomobile" 
    }, 
    { 
     "title": "Giant potatomobile", 
     "link": "https://www.flickr.com/photos/asciident/22115860151/", 
     "media": {"m":"https://farm1.staticflickr.com/646/22115860151_c18609aa78_m.jpg"}, 
     "date_taken": "2015-10-04T17:10:45-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/asciident/\">asciident<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/asciident/22115860151/\" title=\"Giant potatomobile\"><img src=\"https://farm1.staticflickr.com/646/22115860151_c18609aa78_m.jpg\" width=\"186\" height=\"240\" alt=\"Giant potatomobile\" /><\/a><\/p> <p>Near Wendell, Idaho<\/p>", 
     "published": "2015-10-12T06:59:24Z", 
     "author": "[email protected] (asciident)", 
     "author_id": "[email protected]", 
     "tags": "idaho potato wendell potatomobile" 
    }, 
    { 
     "title": "Giant potatomobile", 
     "link": "https://www.flickr.com/photos/asciident/21917906328/", 
     "media": {"m":"https://farm1.staticflickr.com/684/21917906328_fb679fb950_m.jpg"}, 
     "date_taken": "2015-10-04T17:10:44-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/asciident/\">asciident<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/asciident/21917906328/\" title=\"Giant potatomobile\"><img src=\"https://farm1.staticflickr.com/684/21917906328_fb679fb950_m.jpg\" width=\"240\" height=\"180\" alt=\"Giant potatomobile\" /><\/a><\/p> <p>Near Wendell, Idaho<\/p>", 
     "published": "2015-10-12T06:59:24Z", 
     "author": "[email protected] (asciident)", 
     "author_id": "[email protected]", 
     "tags": "idaho potato wendell potatomobile" 
    }, 
    { 
     "title": "Giant potatomobile", 
     "link": "https://www.flickr.com/photos/asciident/22093267702/", 
     "media": {"m":"https://farm1.staticflickr.com/749/22093267702_5f51f6e60e_m.jpg"}, 
     "date_taken": "2015-10-04T17:10:47-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/asciident/\">asciident<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/asciident/22093267702/\" title=\"Giant potatomobile\"><img src=\"https://farm1.staticflickr.com/749/22093267702_5f51f6e60e_m.jpg\" width=\"240\" height=\"180\" alt=\"Giant potatomobile\" /><\/a><\/p> <p>Near Wendell, Idaho<\/p>", 
     "published": "2015-10-12T06:59:25Z", 
     "author": "[email protected] (asciident)", 
     "author_id": "[email protected]", 
     "tags": "idaho potato wendell potatomobile" 
    }, 
    { 
     "title": "Giant potatomobile", 
     "link": "https://www.flickr.com/photos/asciident/21917907758/", 
     "media": {"m":"https://farm6.staticflickr.com/5744/21917907758_f1130f8768_m.jpg"}, 
     "date_taken": "2015-10-04T17:10:40-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/asciident/\">asciident<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/asciident/21917907758/\" title=\"Giant potatomobile\"><img src=\"https://farm6.staticflickr.com/5744/21917907758_f1130f8768_m.jpg\" width=\"240\" height=\"200\" alt=\"Giant potatomobile\" /><\/a><\/p> <p>Near Jerome, Idaho<\/p>", 
     "published": "2015-10-12T06:59:23Z", 
     "author": "[email protected] (asciident)", 
     "author_id": "[email protected]", 
     "tags": "idaho potato jerome potatomobile" 
    }, 
    { 
     "title": "Twister Potato Chip", 
     "link": "https://www.flickr.com/photos/jimmychuah/22104255305/", 
     "media": {"m":"https://farm6.staticflickr.com/5714/22104255305_abe56671da_m.jpg"}, 
     "date_taken": "2015-09-11T16:22:14-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/jimmychuah/\">Jimmy Chuah<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/jimmychuah/22104255305/\" title=\"Twister Potato Chip\"><img src=\"https://farm6.staticflickr.com/5714/22104255305_abe56671da_m.jpg\" width=\"240\" height=\"160\" alt=\"Twister Potato Chip\" /><\/a><\/p> ", 
     "published": "2015-10-12T05:23:56Z", 
     "author": "[email protected] (Jimmy Chuah)", 
     "author_id": "[email protected]", 
     "tags": "travel food holiday stall korea potato snack seoul koreanfood myeongdong 2015" 
    }, 
    { 
     "title": "Potato Rolled Shrimp", 
     "link": "https://www.flickr.com/photos/jimmychuah/21917351019/", 
     "media": {"m":"https://farm1.staticflickr.com/694/21917351019_d93527d6d7_m.jpg"}, 
     "date_taken": "2015-09-11T17:18:27-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/jimmychuah/\">Jimmy Chuah<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/jimmychuah/21917351019/\" title=\"Potato Rolled Shrimp\"><img src=\"https://farm1.staticflickr.com/694/21917351019_d93527d6d7_m.jpg\" width=\"240\" height=\"160\" alt=\"Potato Rolled Shrimp\" /><\/a><\/p> ", 
     "published": "2015-10-12T05:24:05Z", 
     "author": "[email protected] (Jimmy Chuah)", 
     "author_id": "[email protected]", 
     "tags": "travel food holiday stall shrimp korea potato snack seoul koreanfood myeongdong 2015" 
    }, 
    { 
     "title": "fzk_188_28082015_09\'48", 
     "link": "https://www.flickr.com/photos/eduard_buerge-rafz/21901809028/", 
     "media": {"m":"https://farm1.staticflickr.com/619/21901809028_7637fa8cd4_m.jpg"}, 
     "date_taken": "2015-08-28T09:48:46-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/eduard_buerge-rafz/\">eduard43<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/eduard_buerge-rafz/21901809028/\" title=\"fzk_188_28082015_09\'48\"><img src=\"https://farm1.staticflickr.com/619/21901809028_7637fa8cd4_m.jpg\" width=\"240\" height=\"135\" alt=\"fzk_188_28082015_09\'48\" /><\/a><\/p> <p>Die Kartoffel (Solanum tuberosum).<br /> The potato (Solanum tuberosum).<\/p>", 
     "published": "2015-10-11T12:22:17Z", 
     "author": "[email protected] (eduard43)", 
     "author_id": "[email protected]", 
     "tags": "potato kartoffeln naturalproducts solanumtuberosum potatoplants naturprodukte kartoffelstauden" 
    }, 
    { 
     "title": "fzk_189_28082015_09\'48", 
     "link": "https://www.flickr.com/photos/eduard_buerge-rafz/22077208832/", 
     "media": {"m":"https://farm1.staticflickr.com/761/22077208832_e1616a4351_m.jpg"}, 
     "date_taken": "2015-08-28T09:48:51-08:00", 
     "description": " <p><a href=\"https://www.flickr.com/people/eduard_buerge-rafz/\">eduard43<\/a> posted a photo:<\/p> <p><a href=\"https://www.flickr.com/photos/eduard_buerge-rafz/22077208832/\" title=\"fzk_189_28082015_09\'48\"><img src=\"https://farm1.staticflickr.com/761/22077208832_e1616a4351_m.jpg\" width=\"135\" height=\"240\" alt=\"fzk_189_28082015_09\'48\" /><\/a><\/p> <p>Die Kartoffel (Solanum tuberosum).<br /> The potato (Solanum tuberosum).<\/p>", 
     "published": "2015-10-11T12:22:16Z", 
     "author": "[email protected] (eduard43)", 
     "author_id": "[email protected]", 
     "tags": "potato kartoffeln naturalproducts solanumtuberosum potatoplants naturprodukte kartoffelstauden" 
    } 
    ] 
} 

Vous pouvez vérifier que sur jsonlint.com, les deux derniers objets du tableau ont une mauvaise Escaping et d'autres problèmes ... si je les supprimer manuellement le reste de la réponse est un JSON valide. Vous ne pouvez pas corriger cela de votre côté, mais vous devez demander à flickr de fournir un JSON valide.

+0

Merci. Le problème d'origine est que je ne peux pas accéder aux choses dans le JSON, alors y a-t-il un moyen de supprimer ces deux derniers objets côté client? –

+0

Seulement avec string.split(), et c'est un peu la raison pour laquelle vous voulez utiliser JSON en premier lieu: pour ne pas faire d'analyse de chaîne vous-même. Vous devriez contacter le forum api de soutien/développeur de flickr et demander une correction, je pense que c'est peut-être juste cette demande spécifique qui est invalide pour quelques données de titre étranges. – Danmoreng