PHP MySQL to JSON Class

MySQL to JSON appears to be a very useful PHP class that will convert data from MySQL query results into a JavaScript expression in JavaScript Object Notation (JSON).

It takes a MySQL query result handle and retrieves the query result column names and the query result data.

The class generates the definition of a JavaScript object in JSON that contains an array of a rows of query result data.

Each array element represents an object with the properties set to the query result column names. The property values are the query results for the respective row and column.

One Response to “PHP MySQL to JSON Class”

  1. kenrick said on July 8th, 2006 at 8:57 am

    be sure to check out the potential XSS hack when serving up json:

    http://jibbering.com/blog/?p=514