Here is my php code fragment for parsing.
$result=mysql_query($qry);
$Json="{";
for($i=1;$i<=$count;$i++)
{
$row = mysql_fetch_row($result)
$newRow=setJson($i,$row);
if($i!=$count)
$Json=$Json.$newRow.",";
else
$Json=$Json.$newRow;
}
$Json=$Json."}";
$response["success"]=1;
$response["count"]=$count;
$response["rows"]=$Json;
echo json_encode($response);
Function for creating new row
function setJson($i,$row)
{
$setRow="\""$i."\":[".$row."]";
return $setRow;
}
I have developed this using php. I am trying to parse MySQL result to the following format. For each row in DB. I need to update it to SQLite DB in my app.
{
"success":1,
"error":0,
"rows":{
"1":["abc","123"],
"2":["xxx","909"],
"3":["bcn","1bc"]
}
}
{
"tag": "syncMe",
"success": 1,
"error": 0,
"count": "8",
"rows": "{
\"1\":[\"Porotta\",\"22\",\"652+2\",\"veg\",\"dinner\"],
\"2\":[\"chicken curry\",\"90\",\"sdaS\",\"veg\",\"dinner\"],
\"3\":[\"Assd\",\"12\",\"looo\",\"veg\",\"dinner\"]}"
}
How can i remove the slashes in the JSON String.??