Closed nullifiedaccount3 closed 10 years ago
Being more specific
it's not a miracle. Use json_decode and then construct a insert statement using the values of the array.
Here's a simplified php script:
con = mysql_connect("localhost","username","password");
mysql_select_db('your_database',$con);
$result = json_decode($jsonData);
foreach($result as $key => $value) {
if($value) {
mysql_query("INSERT INTO tablename (id, foo, bar) VALUES ($value->id, $value->doo, $value->bar)");
}
}
Additionally there a many tools out there which can convert json files into sql statements vice versa.
Thank you.
Is there a method to convert the JSON database to sql for export it to MySQL or other relational database?