sql_to_json bug with fix

Anonymous
2011-08-29
2013-05-28

  • Anonymous
    2011-08-29

    Hello,

    i encountered a problem while  using sql_to_json.
    When the passed select statement had just 1 row as result, the function would return the json_list as follows :

    but if there were more then one row as the result the json_list would be :

    the fix is to change the line 318 in the json_util_pkg.sql from

    ret.append(json(l_returnvalue).get('ROWSET'));
    

    to

    ret.append(json(json(l_returnvalue).get('ROWSET')).get('ROW'));
    

    Hope this helps someone.
    Joso

     

  • Anonymous
    2011-08-30

    or for cleaner code :

    ret.append(json(l_returnvalue).PATH('ROWSET.ROW'));
    
     
  • Changes are in v1.03