My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What is this psuedo-JSON in my WP database and how to I alter it?

Joseph Thomas's photo
Joseph Thomas
·Apr 28, 2017

I'm working on a large Wordpress migration and, somehow, the previous installation had allowed for non-web-friendly filenames. I'm using javascript (because that's what I know best) to write a script that will look through the tables, find problematic filenames, change them in the database, and then change the actual filename. No problem.

But, some of the files are referenced in some kind of stringified JSON that I don't recognize. For instance:

meta_value: 'a:5:{s:5:"width";i:1044;s:6:"height";i:864;s:4:"file";s:42:"2015/02/The-Impact-of-CAPL-work_2017_1.jpg";s:5:"sizes";a:5:{s:9:"thumbnail";a:4:{s:4:"file";s:42:"The-Impact-of-CAPL-work_2017_1-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:42:"The-Impact-of-CAPL-work_2017_1-300x248.jpg";s:5:"width";i:300;s:6:"height";i:248;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:42:"The-Impact-of-CAPL-work_2017_1-768x636.jpg";s:5:"width";i:768;s:6:"height";i:636;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:43:"The-Impact-of-CAPL-work_2017_1-1024x847.jpg";s:5:"width";i:1024;s:6:"height";i:847;s:9:"mime-type";s:10:"image/jpeg";}s:32:"twentyseventeen-thumbnail-avatar";a:4:{s:4:"file";s:42:"The-Impact-of-CAPL-work_2017_1-100x100.jpg";s:5:"width";i:100;s:6:"height";i:100;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}}'

Is this some wordpress thing? Or a kind of mysql-friendly stringification? How can I safely parse & update it?