gpt4 book ai didi

json - 如何在R中解析奇怪格式的JSON

转载 作者:行者123 更新时间:2023-12-03 09:04:13 24 4
gpt4 key购买 nike

我有一个 JSON,即使使用在线解析器也无法传输:-/我已经尝试过这个,但出现错误

df <- fromJSON("data/part-f1.json", simplifyVector = TRUE, simplifyDataFrame = simplifyVector, simplifyMatrix = simplifyVector, flatten = FALSE)

错误

Error in parse_con(txt, bigint_as_char) : parse error: trailing garbage
6b967967c8","type":"custom"} {"ts":1512318029084,"userid":"5
(right here) ------^

示例 JSON:

{"ts":1512317797740,"userid":"51a35e52c6fba44bd8edba65778c607e","sessionid":"4691122171951068866","re​​mote_ip":"93.72.204.143","platform":"AndroidPlayer","sdk_ver":"u2017 .1.1f1","debug_device":false,"user_agent":"Dalvik/2.1.0 (Linux; U; Android 7.0; XT1650 Build/NPLS25.86-30-5)","submit_time":1512292759927,"名称":"邮箱已激活","custom_params":null,"appid":"4dfb4d07-b463-43d4-ba0b-4c6b967967c8","type":"custom"}{“ts”:1512318029084,“userid”:“51a35e52c6fba44bd8edba65778c607e”,“sessionid”:“4691122171951068866”,“remote_ip”:“93.72.204.143”,“平台”:“AndroidPlayer”,“sdk _ver":"u2017.1.1f1 ","debug_device":false,"user_agent":"Dalvik/2.1.0 (Linux; U; Android 7.0; XT1650 Build/NPLS25.86-30-5)","submit_time":1512292986741,"name":"车轮更换","custom_params":{"车轮尺寸":"17","车轮名称":"Ratikon"},"appid":"4dfb4d07-b463-43d4-ba0b-4c6b967967c8","类型":"自定义”}{“ts”:1512287567257,“userid”:“3996da04b2fef4ac7bf3a47c5b149625”,“sessionid”:“5914000471379591192”,“remote_ip”:“90.178.242.246”,“平台”:“AndroidPlayer”,“sd k_ver":"u2017.1.1f1 ","debug_device":false,"user_agent":"Dalvik/2.1.0 (Linux; U; Android 5.1.1; HUAWEI M2-A01W Build/HUAWEIM2-A01W)","submit_time":1512287567576,"n​​ame": "场景已输入","custom_params":{"场景名称":"_Scenes/intro_scene"},"appid":"4dfb4d07-b463-43d4-ba0b-4c6b967967c8","type":"custom"}

正如你所看到的,在 onlineparser 中我得到了多个根错误。我需要根据这个 JSON 创建一个数据框,但我确实需要帮助。谢谢

最佳答案

也称为ndjson您也可以使用更快且专门构建的 ndjson::stream_in()

关于json - 如何在R中解析奇怪格式的JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48304706/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com