RobG wrote:
Hi,
Sounds fairly trivial.
If by "content" you mean text content, loop
over the rows and create one array for each, stuff the contents of
each cell into a row array element and return it as a JSON formatted
text string, e.g.
Your code does convert the table content into arrays (which was the
first requirement, indeed trivial), but you seem to have stopped before
converting to the JSON format
<URL:
http://www.json.org/>
AFAICS, a JSON entity can contain values such as string, number, object,
array, true, false, null. Since we would originally be parsing text, I
would say that objects and arrays should probably be left unexpanded,
however other values should probably be analyzed and JSON-formatted,
given their final status (valid value or text).
Values such as 'true', false' and 'null' are left "as is", numbers
should be trimmed and checked against a good regexp, and strings should
be surrounded by double quotes (taking care of escaping issues,
essential in serialization processes).
Regards,
Elegie.