Einzelnen Beitrag anzeigen

SyntaxXx

Registriert seit: 14. Dez 2008
328 Beiträge
 
Delphi XE4 Architect
 
#1

SuperObject falsches auslesen

  Alt 4. Mai 2013, 13:27
Ich möchte gerne einen String in Form von einen JSon Rückgabewert parsen, bzw bestimmte teile auslesen.
Doch leider hänge ich fest, weil ich einfach nicht den richiten Rückgabewert bekomme.

Doch hier erst einmal nun der JSon String:
Code:
[{"kind": "Listing", "data": {"modhash": "40rzsb0lre6c724078b437d9451d2991e6004a2b6afe5e4d2f", "children": [{"kind": "t3", "data": {"domain": "flic.kr", "banned_by": null, "media_embed": {}, "subreddit": "pics", "selftext_html": null, "selftext": "", "likes": null, "link_flair_text": null, "id": "1doaji", "clicked": false, "title": "I grew up with a bomb shelter in my back yard.", "media": null, "score": 5, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "http://b.thumbs.redditmedia.com/xMGdxqTo7yuxrd6s.jpg", "subreddit_id": "t5_2qh0u", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 0, "saved": false, "is_self": false, "permalink": "/r/pics/comments/1doaji/i_grew_up_with_a_bomb_shelter_in_my_back_yard/", "name": "t3_1doaji", "created": 1367697518.0, "url": "http://flic.kr/s/aHsjEXdyeP", "author_flair_text": null, "author": "npanth", "created_utc": 1367668718.0, "ups": 5, "num_comments": 1, "num_reports": null, "distinguished": null}}], "after": null, "before": null}}, {"kind": "Listing", "data": {"modhash": "40rzsb0lre6c724078b437d9451d2991e6004a2b6afe5e4d2f", "children": [{"kind": "t1", "data": {"subreddit_id": "t5_2qh0u", "banned_by": null, "subreddit": "pics", "likes": null, "replies": "", "id": "c9s83w4", "gilded": 0, "author": "kasabian1988", "parent_id": "t3_1doaji", "approved_by": null, "body": "I think old bomb shelters are really cool. ", "edited": false, "author_flair_css_class": null, "downs": 0, "body_html": "<div class=\"md\"><p>I think old bomb shelters are really cool. </p>\n</div>", "link_id": "t3_1doaji", "score_hidden": false, "name": "t1_c9s83w4", "created": 1367697683.0, "author_flair_text": null, "created_utc": 1367668883.0, "ups": 1, "num_reports": null, "distinguished": null}}], "after": null, "before": null}}]

Wenn man diesen nun in einen Online JSon Parser eingibt, bekommt man diesen schön unterteilt.
Hier nun der für mich interessante Pfad:
1
|-data
|--|-children
|-------|-0
|---------|-data
|-------------|-body

Und so rufe ich diesen auf:
jSon.S['1.data.children[0].data.body'] Doch jedesmal bekomme ich als Ausgabe "1." zurück.

Könnt ihr mir sagen, wie ich es richtig mache?
  Mit Zitat antworten Zitat