且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

比较两个JSON对象,无论它们中元素的顺序如何

更新时间:2022-03-15 21:41:22

您可以使用 jsondiff

from jsondiff import diff
diff(json1, json2)

......假设您已从示例中加载了json条目的json1和json2(顺便说一句,在"sex"条目之后您缺少逗号).

... assuming you have json1 and json2 loaded with the json entries from your example (and by the way, you have a missing comma after the 'sex' entry).