Mike Assad
asked on
Importing a JSON response to MySQL in Laravel
I am using the API of a program to get data through Laravel's HTTP function. The request comes back in JSON format like this:
In summary, how can I get each of the "call" rows above into a database? Any advice is appreciated. Thank you.
{
"response": {
"method": "12345",
"result": {
"calls": {
"total_pages": "1",
"total_items": "6",
"call": [
{
"uniquevalue": "value",
"key1": "value",
"key2": "value",
"key3": "value"
},
{
"uniquevalue ": "value",
"key1": "value",
"key2": "value",
"key3": "value"
},
{
"uniquevalue ": "value",
"key1": "value",
"key2": "value",
"key3": "value"
}
],
"items_per_page": "999",
"page_number": "1"
}
}
}
}
I want to take the data bolded above (each row under (response -> result-> calls -> call) and import them to a MySQL database. Normally, I would do this by doing a foreach loop, which may not be the right way. But in this case, I don't know how to do even that because I don't know how to access the nested json rows.In summary, how can I get each of the "call" rows above into a database? Any advice is appreciated. Thank you.
you want this in JS/jQuery or php?
ASKER
I want it in php.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.