I want to parse following JSON object to perform mysql query.
$json_data = '{
"table":"login",
"operation":"insert",
"columns": [
{
"valid": "yes",
"deviceid": "gt456"
},
{
"valid": "yes",
"deviceid": "gt896"
}
],
"where":[
{ "username": "max" },
{ "username": "steve"}
]
}';
On parsing it will parse table, operation(insert/update/delete), columns affected by operations and where clause. How do i do it using PHP to execute desired sql query as per JSON input. Please help.
json_decode
is your friend. – j0k Mar 11 at 12:19