StuiterSlurf StuiterSlurf - 1 year ago 73
JSON Question how they do it

I got the following string:


I can't use


because it doesn't return anything. I found 2 websites that where a bit usefull: for checking if the object is valid (what it ain't) and wich can 'unserialize' the json string back to an array.

Now I wonder what unserialize does to the json string. So I can use it in my script as well.

Answer Source

Looks like this is in serialized form. You need to use unserialize() function here.

$input = 'a:16:{i:0;s:1:"6";i:1;s:2:"12";i:2;s:1:"2";i:3;s:2:"11";i:4;s:1:"7";i:5;s:2:"10";i:6;s:2:"16";i:7;s:1:"5";i:8;s:1:"3";i:9;s:1:"1";i:10;s:2:"14";i:11;s:1:"8";i:12;s:2:"13";i:13;s:1:"9";i:14;s:1:"4";i:15;s:2:"15";}';

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download