javascript - Make Json parsable by php -


I have some strangely formatted Jason String which is an invalid Jason but executes as valid JavaScript. This means PHP json_decode , will not work.

  {"device": {"Device1": "{\" name \ "= \ & gt; \" autope ldvds \ ", \" id \ "= \> gt; "LDVDSDevice \"}}}   

Backlash is not valid. Is there any way I can escape this string so that it can be done exactly as it did? ?

Edit I do not care to parse the filthy string all. This is preventing me from accessing other data I was a simple Regex to parse it Haze Jason's ugly string strip out but now I need to re-encode the result array JSON and I do not want to lose this data. The ugly string should be exactly the same as it is important for any other application using the data May be.

=> Comes to the Ruby object node if you are thinking.

OK, it has left those weird & gt; < / Code> Those who are killing it: <>>

I have no reason to protect you str_replace with an existence Can not safely:

  & lt ;? Php $ code = '{"device": {"Device1": "{\" name \ "= \ & gt; \" autope ldvds \ ", \" id \ "= \> \" ldvds device \ "} "}} '; $ Code = str_replace ('\\ & quot;', '& gt;', $ code); Var_export (json_decode ($ code));   

But then, you know the domain of your data .
And you should apply the salt unveiling before applying eyes with eyes for all your inputs.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -