I'm trying to parse a JSON file using ISuperObject. My JSON file looks like this:
{
"status":"ok",
"follows":{
"count":868,
"page_info":{
"has_previous_page":false,
"start_cursor":null,
"end_cursor":"SbXc6VJsoeTs",
"has_next_page":true
},
"nodes":[
{
"username":"username1",
"requested_by_viewer":false,
"followed_by_viewer":true,
"profile_pic_url":"URL link",
"full_name":"name",
"is_verified":false,
"id":"ID"
},
{
"username":"username2",
"requested_by_viewer":false,
"followed_by_viewer":true,
"profile_pic_url":"URL link",
"full_name":"username2",
"is_verified":false,
"id":"ID"
},
{
"username":"_username3",
"..."
]
}
I want all of the username
values to be listed in a Memo.
Here is what I have tried:
var
json : ISuperObject;
row_item : ISuperObject;
begin
json := TSuperObject.ParseFile('C:\json.txt', TRUE);
for row_item in json['nodes'] do
begin
Memo1.Lines.Add(elements_itemS['usernames']);
end;
end;
I get an Access Violation on the for
loop. Any ideas?
do through elements array** is acceptable to the compiler? It's not valid code - valid code *compiles*. I'm fully aware of the correct syntax to use for `for..in`, and that isn't it. The poster should include **valid code**.
– Ken White Jun 28 '16 at 02:26