Fixed the to_json methods to return a json string