serialization - How to extract data from Mysql column stored in serialized JSON column? -


i have column in mysql db contains serialized data (used php json encode serialize them).

here example:

{"name":"group ltd","email":"support@domain.org","auth":"andrey ucholnik"}

is there built in function in mysql extract these values without php ? mean build query unserialize data.

of course possible use combination of locate , substr function prefer built in if possible.

there no build in function in mysql using small code in php can under:

<?php     $json = '{{"generated": "2010-02-26t22:26:03.156866   blahblahblah   ": null, "thumbnail_url": "http://thumbs.mochiads.com/c/g/tetword-pro/_thumb_100x100.jpg", "screen4_url": "http://thumbs.mochiads.com/c/g/tetword-pro/screen4.png", "leaderboard_enabled": true, "resolution": "600x550", "width": 600}]}}';     $out = json_decode($json, true);     foreach($out["games"] $game) {         $name = addslashes($game[name]);         $description = addslashes($game[description]);         //here can use mysql_insert code         mysql_query("insert games (name, description) values('$name', '$description')") or die (mysql_error());     }  ?> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -