M
Marko Anastasov
Hi,
I didn't find a mailing list dedicated to ruby-json, so I assume that
this would be
the correct place to ask.
From a web API, I receive a JSON stream such as:
[{"u":"http://...html","d":"some title","t":["ruby"]},
{"u":"http://....org/","d":"another title","t":
["ruby","json","library"]},...]
Now, among the rest, I also want to access those "ruby", "json" and
"library" strings.
With the following code:
@structs = JSON.parse(@json_stream)
for i in (e-mail address removed)
@struct_obj = @structs.fetch(i)
@struct_obj.each { |key, value|
if key == "t"
# get the value that 't' points to
end
}
end
I get them all appended to each other without any whitespace, ie
"rubyjsonlibrary".
How could I access them individually?
Marko
I didn't find a mailing list dedicated to ruby-json, so I assume that
this would be
the correct place to ask.
From a web API, I receive a JSON stream such as:
[{"u":"http://...html","d":"some title","t":["ruby"]},
{"u":"http://....org/","d":"another title","t":
["ruby","json","library"]},...]
Now, among the rest, I also want to access those "ruby", "json" and
"library" strings.
With the following code:
@structs = JSON.parse(@json_stream)
for i in (e-mail address removed)
@struct_obj = @structs.fetch(i)
@struct_obj.each { |key, value|
if key == "t"
# get the value that 't' points to
end
}
end
I get them all appended to each other without any whitespace, ie
"rubyjsonlibrary".
How could I access them individually?
Marko