Expecting value: line 2 column 1 (char 2)
时间: 2023-08-29 19:11:49 浏览: 312
Expecting value: line 2 column 1 (char 2)错误是由于在解析JSON字符串时,遇到了格式错误导致的。这个错误通常表示JSON字符串的格式无效,值得关注的是行2列1处(即索引为1)的字符。根据引用、和提供的信息,这个错误通常发生在json.loads函数中,它无法正确解析以单引号包围的字符串。在Python中,json.loads函数只能解析双引号包围的字符串作为有效的JSON格式。因此,为了解决这个问题,我们需要将单引号替换为双引号,以便json.loads函数可以正确解析字符串。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [python JSON ValueError: Expecting property name: line 1 column 2 (char 1)](https://blog.csdn.net/a1007720052/article/details/78252452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [json.loads报错json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)](https://blog.csdn.net/cute_boy_/article/details/119208011)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文