I thought I would test and convert non-serialiazable value before being passed back to the front-end.
This one liner does quite a lot. The function ensure_anvil_serialiazable(item)
test wether anvil will be ok with the value
. At this stage, it prints out the type
of the item and simply return the item.
result = [{indx: {"value": ensure_anvil_serializable(x[indx].toPython()), "type": str(type(x[indx]))} for indx in x.labels} for x in res]
When I return result
, I get the message
anvil.server.SerializationError: Cannot serialize return value from function. You can only pass strings, numbers, arrays, lists, LiveObjects and Media to or from server functions
Any ideas how to fix this?