The horrible system we use in my company gives me the following output:
{
party:"bases",
number:"1",
id:"xx_3039366",
url:"systen01-ny.com",
target:"_self",
address:"Ch\u00e3o as Alminhas-Medas,Uteiros de Gatos e Fontes Longaq<br/>64320-761 ANHADOS LdA",
coordinate:{
x:90.995262145996094,
y:-1.3394836426
},
contactDetails:{
id:"366",
phone:"xxxxxx",
mobile:"",
fax:"xxxx 777 235",
c2c:!0
},
parameters:"Flex Am\u00e1vel Silva,hal,,EN_30336,S,786657,1,0,",
text:"Vila Nova de Loz C\u00f4a,os melhores vinhos, v\u00e1rias. Produtor/exportador/com\u00e9rcio",
website:null,
mail:"",
listing:"paid",
pCode:"64",
name:"xpto Am\u00e1vel Costa",
logo:{src:"http://ny.test.gif",
altname:"xpto Am\u00e1vel Costa"},
bookingUrl:"",
ipUrl:"",
ipLabel:"",
customerId:"7657",
addressId:"98760",
combined:null,
showReviews:!0
}
I would like to know if there is a way to convert the output to array, as if it were a json, or even some other format that I can manipulate this data in PHP. Json_decode does not work.
Just like I said I would, here your very own Json Object parser.
One word of warning, these kind of things can be more art then science so if your inputs vary from what was in your example, it could have issues. Given the small sample size (1 document) I make no guarantees on it's functionality outside that one example.
I would try to explain how this works, but I fear it would be lost on mere mortals.
Seriously, this was fun, enjoyed the challenge for once.
Outputs ( this is what everyone wants )
And you can even test it here ( because I am a nice guy )
http://sandbox.onlinephpfunctions.com/code/3c1dcafb59abbf19f7f3209724dbdd4a46546c57
I was able to fix the encoding issues
\u00e
etc with help of this SO post, so a shout out to them, because I hate character encoding.http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
Man I just love a beautiful piece of code, just umm.
Cheers!