I have a text file that is formatted like JSON, but in a print / view friendly format and that string Actually for valid JSON, I want to read the file using PHP5 and want to call json_decode to deserialize the string. However, json_decode is not able to parse "print-friendly" Jason string.
I'm getting error 4 invalid or incorrect JSON
It seems that someone else has a similar problem
How do I
FROM:
"" "State": "State": "Texas", "White": "Road", "City": "Fort Worth", "State": "[Thom Img" Zip ":" 76192-0001 "," url ":" url "}]}TO:
"Data": "Texas", "Zip": "76192-0001", "Texas", "Land": "Street": "Road", "City": "Fort Worth", "State" Url ":" Url "}]
I also tried to do the following:
& lt ;? Php $ filename = "links.json"; $ File = fopen ($ filename, "r"); $ Lines = file ($ filename); $ Data = ""; ; Forex Currency ($ line_name = & gt; lines as line $) {$ formatted = trim ($ line); $ Formatted = str_replace ("\ r", "", $ formatted); $ Formatted = str_replace ("\ n", "", $ formatted); $ Data = $ Formatted; } $ Json = json_decode ($ data, true); ? & Gt;
I have done Var_dump of the resulting JSSN string and marked it as valid Jason; However, json_decode Jason String is not able to deserialize for some reason.
Thank you!
Solution I thank the text file encoding without UTF-8 bombs and it works fine!
& lt; Php $ filename = "links.json"; $ File = file_get_contents ($ filename); $ Json = json_decode ($ file, true); ? & Gt;
References:
-
-
Comments
Post a Comment