PHP速学视频免费教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
我有这个 JSON 文件:
https://drive.google.com/file/d/1zh_fJJNWs9GaPnlLZ459twSubsYkzMi5/view?usp=share_link
一开始看起来很正常,即使使用在线 json 模式验证器 但是,当在本地解析它时,我收到错误。 我用 python、nodejs 和 golang 尝试过,但它不起作用。 我认为它可能有一些隐藏的价值,使得无法解析它
这是完整的解决方案。针对代码添加的注释。
# read the file as bytes import chardet import json file_path=r"2022_2973.json" with open (file_path , "rb") as f: data= f.read() # read file as bytes file_encoding=chardet.detect(data)['encoding'] # detect the encoding print(f"file(bytes) encoding:{file_encoding}") # print encoding json_data = json.loads(data.decode(file_encoding)) # decode the bytes and load the json data json_data['snaps'][1]
输出:
file(bytes) encoding:UTF-16 {'group': 'Slot', 'group_order': 1, 'positions': [{'group': 'Slot', 'position': 'SLWR',
已抢6717个
抢已抢90861个
抢已抢14323个
抢已抢50399个
抢已抢189616个
抢已抢86052个
抢