Added tests for to_json