0

Hullo :3
I'm currently dabbling with the Twitter API and would like to decode a JSON response similar to this: https://dev.twitter.com/docs/api/1.1/get/users/lookup (bottom of page).

I'm quite a novice with PHP (14 y/o) so please don't be harsh with the dislikes. I have scoured the Internet before asking this question. There are one or two relevant tutorials but they just confuse me even more. So please, don't be harsh, and explain how I'd achieve this as easily as possible so I can get my head around it. :)

I know you can't decode this type of response easily because it has two parts, one for each user requested.

Thank you in advance and have a great day.

1

2 Answers 2

1

All you need is json_decode.

The result will be an array with your user objects.

Sign up to request clarification or add additional context in comments.

Comments

0

Just use json_decode. After that you can use foreach to get the single objects.

$allobjects = json_decode($json);
foreach ($allobjects as $singleobject) {
     //handle the single objects    
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.