Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone

can any one tell me how do I use Json_decode in php. I have simple json file
I couldn't use it to extract all data.

see this

PHP
$decode =json_decode('{
        "worldpopulation":
	    [
		 {
		 "rank":1,"country":"China",
		 "population":"1,354,040,000",
		 "flag":"http://www.androidbegin.com/tutorial/flag/china.png"
		 },

		 {
		 "rank":2,"country":"India",
		 "population":"1,210,193,422",
		 "flag":"http://www.androidbegin.com/tutorial/flag/india.png"
		 },

		 {
		 "rank":3,"country":"United States",
		 "population":"315,761,000",
		 "flag":"http://www.androidbegin.com/tutorial/flag/unitedstates.png"
		 }
	]
}');


I want to extract all data?

Sorry for English
Posted
Updated 11-Apr-15 10:14am
v2

1 solution

This is explained here: http://php.net/manual/en/function.json-decode.php.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900