Json problem in flickr
I have this json but I have no idea how to get 7796249@N02
a:2:{s:4:"user";a:3:{s:2:"i开发者_JAVA技巧d";s:11:"7796249@N02";s:4:"nsid";s:11:"7796249@N02";s:8:"username";a:1:{s:8:"_content";s:9:"ilhan.z.y";}}s:4:"stat";s:2:"ok";}
That is a serialized PHP array, not JSON. Use:
$array = unserialize('that response goes in here');
What language are you using? In Groovy, for example, you would do something like this:
import groovyx.net.http.*
@Grab(group='org.codehaus.groovy.modules.http-builder',
module='http-builder', version='0.5.0' )
def http = new HTTPBuilder( 'http://twitter.com/statuses/' )
http.get( path: 'user_timeline.json', query: [id:'httpbuilder', count:5] ) { resp, json ->
println resp.status
json.each { // iterate over JSON 'status' object in the response: println it.created_at println ' ' + it.text } }
Edit after PHP tag added:
I'm not a PHP guy, but it looks like json_decode is what you need to use.
精彩评论