Add testing of to_json