I've run into an issue wherein I get a formatted message created by these util functions:
Example output:
MSG(variable_group=MSG(x=0,y=0,z=0), variable1='name', variable2=1)
Here are the functions used to make the message.
def _json_object_hook(d):
return namedtuple("MSG", d.keys())(*d.values())
def json2obj(data):
return json.loads(data, object_hook=_json_object_hook)
I want to convert the above output back into a json object to convert into a python dictionary, but I am unsure how to go about that with the object_hook and namedtuple.