Oh, right. The builtin JSON function is a little weird. Either of these seem to work:
import json
from java.util import Date
class IgnitionEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, Date):
return obj.time
elif hasattr(obj, "keys"):
return dict(obj)
elif hasattr(obj, "__iter__"):
return list(obj)
return json.JSONEncoder.default(self, obj)
j = json.dumps(self.custom.controlAccess, cls=IgnitionEncoder, indent=4)
system.perspective.print(j)
from com.inductiveautomation.ignition.common import TypeUtilities
system.perspective.print(TypeUtilities.gsonToPy(TypeUtilities.pyToGson(self.custom.controlAccess)))