How do you serialize a model's state dictionary to json

I need to store the models state as json. Is there a way to get a json representation of the model’s state_dict?

I would say you can use tensor’s method to_list() to get a plain representation of a tensor as a list of lists. That way you can export the state dict as a json and recover it back.