Add json cast function to db