SQLAnywhere currently provides the ability to create a web service of TYPE 'JSON' that can return a JSON-serialized result set.
Sample output of a web service returning "select * from people":
Example showing how a "JSON" function that operates in a similar manner to XMLELEMENT() might be used:
could produce something like (formatted for readability):
I'd be happy with just getting the result set array notation string and constructing the JSON manually though if the serialization function were exposed.
While there is no native SQL support for doing this, you could make use of external environments and/or external functions. There are a whole bunch of existing libraries that generate and parse JSON that would work, depending on the language you choose.
If you just want to generate it, JSON is a very simple format that could be built without too much trouble with SQL in a few stored procedures.
Either way, you would need to make your service RAW and then build the JSON string yourself.
answered 01 Apr '10, 14:39
There is currently no method (short of writing the SQL code to do it yourself) to generate JSON using the built-in code within SA ... but this feature is being consider for the next release.
answered 30 Mar '10, 19:34