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 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. OK, it has left those weird I have no reason to protect you But then, you know the domain of your data . json_decode , will not work.
{"device": {"Device1": "{\" name \ "= \ & gt; \" autope ldvds \ ", \" id \ "= \> gt; "LDVDSDevice \"}}}
=> Comes to the Ruby object node if you are thinking.
& gt; < / Code> Those who are killing it:
<>>
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));
And you should apply the salt unveiling before applying eyes with eyes for all your inputs.
Comments
Post a Comment