Vinicius Fontoura
Vinicius Fontoura

Reputation: 163

What kind of serialized array is this?

I'm trying to figure out what type of array is that:

I found it on a Wordpress database, how can I tranform into a json string?

a:6{i:0;s:3:\"948\";i:1;s:3:\"949\";i:2;s:3:\"951\";i:3;s:3:\"952\";i:4;s:3:\"953\";i:5;s:4:\"1742\";}

Upvotes: 0

Views: 35

Answers (2)

mark.sagikazar
mark.sagikazar

Reputation: 1042

It seems that the data is corrupted:

$content = 'a:6:{i:0;s:3:"948";i:1;s:3:"949";i:2;s:3:"951";i:3;s:3:"952";i:4;s:3:"953";i:5;s:4:"1742";}'
json_encode(unserialize($content));

Note the missing colon after "a:6"

Upvotes: 1

HeadwindFly
HeadwindFly

Reputation: 884

It seems like generated by serialize(), you can unserialize it by invoking the method unserialize()

Upvotes: 0

Related Questions