Copy your JSON string into https://jsonlint.com/ again and Validate. You will get the above error. Jsonlint will reformat the string during validation. The valid portion of the string ends at line 17 with a }. That is the EOF mark but your string has additional characters starting on line 18. Remove everything after line 18 and revalidate. You will have a valid JSON string.
Make sure your server side code does not append what is starting at line 18 to your JSON string.
I think it has something to do with the charset. Make sure you have this line in the <head> section: <meta charset="utf8">
In your connection settings also put the charset=utf8: $connection = new PDO( 'mysql:host=localhost;dbname=mytest;charset=utf8', $username, $password );
I could reproduce the error. When I omit the charset on both files I was looking at the message: "This request has no response data available" and the network response didn't display anything.
Also strange, when I omit the charset, the first page just rendered well but clicking the second page (I had pagination on) it came up empty with the word "Processing . . ." and when I clicked the sixth page the data was spit out correctly.
Perhaps somebody else can benefit from my posting and more important, can reproduce the behavior.
Answers
Hello @allan, I am using in production server PHP version 7.0. In localhost is 7.0.10.
@Rodidi yes, I am using some words like "irmãos". I did what you said:
and now I have this JSON, that is still invalid:
Copy and paste it into this site:
https://jsonlint.com/
You will see what is invalid.
Kevin
It's adding \/ and others caracters (\u00e9) when words have accentuation. How can I fix this @kthorngren?
And on line 17 there was pointing that there was an extra
}
. If I keep removing the suggestion, I end in removing everthing!The JSON is appended with this starting on line 18:
If you remove lines 17 through 109 and "Validate" the JSON you will see its now valid.
Kevin
I didn't understand what you said now. @kthorngren
Copy your JSON string into https://jsonlint.com/ again and Validate. You will get the above error. Jsonlint will reformat the string during validation. The valid portion of the string ends at line 17 with a
}
. That is the EOF mark but your string has additional characters starting on line 18. Remove everything after line 18 and revalidate. You will have a valid JSON string.Make sure your server side code does not append what is starting at line 18 to your JSON string.
Kevin
Okay, thanks for your advice @kthorngren .
Looks like you have some debug output that is marring the JSON return.
Allan
I think it has something to do with the charset. Make sure you have this line in the
<head>
section:<meta charset="utf8">
In your connection settings also put the charset=utf8:
$connection = new PDO( 'mysql:host=localhost;dbname=mytest;charset=utf8', $username, $password );
I could reproduce the error. When I omit the charset on both files I was looking at the message: "This request has no response data available" and the network response didn't display anything.
Also strange, when I omit the charset, the first page just rendered well but clicking the second page (I had pagination on) it came up empty with the word "Processing . . ." and when I clicked the sixth page the data was spit out correctly.
Perhaps somebody else can benefit from my posting and more important, can reproduce the behavior.
Hello,
this problem is due to the class ssp.
The default connection does not support utf8 and the accented characters are bugged next.
Modify the file 'ssp.class.php' and replace in the function 'function sql_connect' the following code:
By :