import json

try: long = long
except NameError:
     long = int

class hexint(int):
    def __str__(self):
        return hex(self)

class hexlong(long):
    def __str__(self):
        return hex(self)

class Hexifyint(object):
    def __call__(self, jsonobj):
        h = getattr(self, 'hexify_'+jsonobj.__class__.__name__, lambda x, y: x)
        return h(jsonobj, jsonobj.__class__)

    def hexify_list(self, lst, cls):
        return cls(self(item) for item in lst)
    hexify_tuple = hexify_list
    def hexify_dict(self, dct, cls):
        return cls((self(k), self(v)) for k, v in dct.items())
    hexify_OrderedDict = hexify_dict
    def hexify_int(self, i, cls):
        return hexint(i)
    def hexify_long(self, i, cls):
        return hexlong(i)

data = {'test': 33, 'this': 99, 'something bigger':[1,2,3, {'a':44}]} 
print(json.dumps(Hexifyint()(data)))