fix test where to_json method is compare to a string

as in pyhton and json the order of the keys is not garantee,
we cannot compare to_json output directly with a hardcoded string.
I'ts better to transform both the hardcoded dtring and the to_json
output in json with the json library and compare the 2 resulting objects