Skip to Content

SQL Anywhere 12 Webservice returns malformed JSON float values

The table column is:

"duration" DOUBLE NULL

The Webservice is defined as:

CREATE SERVICE "myservice" TYPE 'JSON' AUTHORIZATION OFF USER "xyz" URL ELEMENTS AS select [...],duration from mytable [...];

The returned JSON:

[

    {

        [...]

        "duration": .45

    },

    {

        [...]

        "duration": .37

    },

[...]

JSLint (and Ruby) say:

Parse error on line 7:

...        "duration": .45    },    {  

-----------------------^

Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

A workaround would be to select string(duration), but that would not work with select *

Is there any option I need to set or is it a bug?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 25, 2014 at 03:20 PM

    This looks like a bug (the JSON is formatted correctly in version 16).  You might want to try more recent patch for version 12 (you didn't state which build number of version 12 you are using) to see if it has already been fixed.

    --Jason

    Add comment
    10|10000 characters needed characters exceeded