I created a php file to generate JSON code.
My php code is:
<?php
include ('config.php');
mysql_query('SET CHARACTER SET UTF8');
mysql_query("SET NAMES utf8; ");
$check = mysql_query("SELECT * FROM news WHERE 1");
while($row=mysql_fetch_assoc($check))
$output[]=$row;
$json_encode =json_encode($output);
$utf8_decode = utf8_decode($json_encode);
echo $json_encode;
mb_convert_encoding($json_encode, 'UTF-8');
$html_entity_decode = html_entity_decode($json_encode);
mysql_close();
?>
and the output is in this link: here
But when I check the validation of the JSON format in this site: here
It gives me the following error:
The JSON input is NOT valid according to RFC 4627 (JSON specification). Unexpected token [{"news_id":"11","news_content":"\u0639\u0637\u0648\u0631 \u0628\u0623\u062e\u0641 \u0627\u0644\u0627\u062d\u062c\u0627\u0645 \u062a\u0635\u0644\u062d \u0644\u062c\u0645\u064a\u0639 \u062...
And this affects the parsing in Java and gives me the following Exception:
Error parsing data org.json.JSONException: Value of type java.lang.String cannot be converted to JSONArray
How to solve this issue?
Thanks in advance.