json_util_pkg generates invalid JSON for numbers less than 1
Opened this issue · 1 comments
eaolson commented
The json_util_pkg will generate invalid JSON with the value getting converted is a number between 0 and 1.
BEGIN
dbms_output.put_line( json_util_pkg.sql_to_json( 'select 0.5 as x from dual' ));
END;
/
Generates:
{"ROWSET":{"ROW":{"X":.5}}}
Neither IE 11 nor Firefox 35 will parse this result. The JSON specification says that numbers must begin with a digit. Numbers beginning with the decimal point are invalid.
eaolson commented
It looks like the problem lies in the xml2json-xslt stylesheet this package relies on to make the xml-to-JSON conversion. The project for this stylesheet has migrated to https://github.com/doekman/xml2json-xslt. I tried the latest version, but it did not fix the problem.