function jsonOutput($query)
{
#json convert
$ofirst = true;
print "[\n";
foreach ($query as $row)
{
if($ofirst) $ofirst = false;
else print ",\n";
$first = true;
print "{";
foreach ($row as $key => $value)
{
if($first) $first = false;
else print ",";
if(is_numeric($value))
print $key . ': ' . $value;
else
print $key . ': "' . $value . '"';
}
print "}";
}
print "\n]\n";
}
Showing posts with label json. Show all posts
Showing posts with label json. Show all posts
Thursday, July 14, 2011
A php sqlite to json converter page
Next I build basically a quick converter page to convert an sqlite query result into json
Subscribe to:
Posts (Atom)