getsizeof(my_dictionary)
getsizeof(json.dumps(my_dictionary))
size = getsizeof(my_dictionary)
size += sum(map(getsizeof, list(my_dictionary.values()))) + sum(map(getsizeof,
    list(my_dictionary.keys())))
size
Memory-usage of dictionary in Python?