As far as I can see decimal fields like the following are not
supported in JSON services.

    Field('car_price', 'decimal(8,6)', requires=IS_NOT_EMPTY()),

In functions like:

@service.json
def getjson():
    return mydata

web2py framework uses simplejson for serialization.

The release version of web2py will fail on execution of such a
procedure with error:
"Decimal(\'21211.12\') is not JSON serializable"

Starting from version 2.1 simplejson library supports decimals which
can be serialized, but it requires a special argument ('use_decimal')
provided in dumps():

gluon\serializers.py:

def json(value,default=custom_json):
    return simplejson.dumps(value,default=default,use_decimal=True)

Please include it somehow in next releases of web2py, thanks.

Reply via email to