Click here to Skip to main content
15,867,901 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I try to get json file data and insert it into table.

What I have tried:

$data = json_decode($json, true);
     
 		foreach ($data as $key => $value)
Posted
Comments
Chris Copeland 15-Oct-21 5:12am    
If this is where the problem exists then it sounds like PHP isn't able to decode the JSON content correctly, have you tried printing out the value of $data to inspect what the content looks like?

var_dump($data);
A Ali_786 15-Oct-21 5:18am    
var_dump($data); > It show me Null
Richard Deeming 15-Oct-21 5:34am    
So either $json is null, or it isn't valid JSON.

Dump the content of the $json variable to see what it contains. Then check where you got it from to find out why it's not populated with the expected value.
A Ali_786 15-Oct-21 10:24am    
thanks, I solved my issue.

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