Skip to content

Commit 9c31732

Browse files
TST: add read_json test #GH32383 (#33345)
1 parent 9e8ccd7 commit 9c31732

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/tests/io/json/test_json_table_schema.py

+18
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,24 @@ def test_build_series(self):
241241

242242
assert result == expected
243243

244+
def test_read_json_from_to_json_results(self):
245+
# GH32383
246+
df = pd.DataFrame(
247+
{
248+
"_id": {"row_0": 0},
249+
"category": {"row_0": "Goods"},
250+
"recommender_id": {"row_0": 3},
251+
"recommender_name_jp": {"row_0": "浦田"},
252+
"recommender_name_en": {"row_0": "Urata"},
253+
"name_jp": {"row_0": "博多人形(松尾吉将まつお よしまさ)"},
254+
"name_en": {"row_0": "Hakata Dolls Matsuo"},
255+
}
256+
)
257+
result1 = pd.read_json(df.to_json())
258+
result2 = pd.DataFrame.from_dict(json.loads(df.to_json()))
259+
tm.assert_frame_equal(result1, df)
260+
tm.assert_frame_equal(result2, df)
261+
244262
def test_to_json(self):
245263
df = self.df.copy()
246264
df.index.name = "idx"

0 commit comments

Comments
 (0)