cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere 12 Webservice returns malformed JSON float values

aplsystems_cs
Explorer
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

JasonHinsperger
Advisor
Advisor
0 Kudos

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

aplsystems_cs
Explorer
0 Kudos

You are right my dev machine has a really old build: 12.0.0.2601

I will update to 12.0.1 SP75 Build 4124 (slow download here) and report back

aplsystems_cs
Explorer
0 Kudos

Thanks, it works fine in 12.0.1.4124

there now is a zero before the decimal point as expected.


"duration": 0.45

Answers (0)