ValueError: Expecting property name: line 1 column 2 (char 1)

代码:

import json

str2 = ‘{"domain":"456"}‘
str1 = "{‘domain‘:‘123‘}"
print json.loads(str2)
print json.loads(str1)

python json.loads() 标准的书写键与值 ,以双引号作为解析标准。单引号则会报错。

原文地址:https://www.cnblogs.com/qxh-beijing2016/p/11693045.html

时间: 2024-10-09 02:46:53

ValueError: Expecting property name: line 1 column 2 (char 1)的相关文章

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

上篇博客提到了爬取动态数据,但是在构造request_url时,其中的url我用的浏览器的网址,但是经过运行发现,有时可以运行成功,有时 request_url = "http://tool.manmanbuy.com/history.aspx?DA=1&action=gethistory&url={0}&bjid=&spbh=&cxid=&zkid=&w=951&token={1}".format(url, token)

python:json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes问题解决

有如下一个文件,内容如下 { "test1": "/root/test/test1.template", "test2": "/root/test/test2.template", "test3": "/root/test/test3.template", "test4": "/root/test/test4.template", "te

报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17) equal symbol expected

现象:写了如下一个jsp文件,导入需要用到的两个包: 运行结果报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17) equal symbol expected at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41) at org.apache.jasper.compiler.ErrorDis

Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "</url-pattern>" 终止

1.错误描述 严重: Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "</url-pattern>" 终止. org.xml.sax.SAXParseException; systemId: jndi:/localhost/SpringMVCH/WEB-INF/web.xml; lineNumber: 41; columnNumber: 24; 元素类型 &qu

error: &lt;class &#39;xml.parsers.expat.ExpatError&#39;&gt;, syntax error: line 1, column 0: file: /usr/local/lib/python2.7/xmlrpclib.py line: 557

当linux设备上开启sonar6.2时, supervisorctl status报如下错误: error: <class 'xml.parsers.expat.ExpatError'>, syntax error: line 1, column 0: file: /usr/local/lib/python2.7/xmlrpclib.py line: 557 关闭sonar6.2时,报如下错误: error: <class 'socket.error'>, [Errno 113]

SSH框架-unexpected token: * near line 1, column 8 [select * from tb_chaper where course_id = 2];报错解决方法

SSH项目,访问jsp页面出现报错,控制台显示报错信息: org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: * near line 1, column 8 [select * from tb_chaper where course_id = 2]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpect

org.apache.jasper.JasperException: /pages/column.jsp (line: 8, column: 1) File &quot;pathTags.jsp&quot; not f

1.错误描述 21-Mar-2015 00:57:40.934 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed() 21-Mar-2015 00:57:40.934 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Con

java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 296

先贴代码 public class ListDataRequest extends JsonRequest<ArrayList<Note>> { public ListDataRequest(int method, String url,Map<String,String> contentBody, Listener<ArrayList<Note>> listener, ErrorListener errorlistener) {  super(

Exception in thread &quot;main&quot; expected &#39;&lt;document start&gt;&#39;, but found BlockMappingStart in &#39;reader&#39;, line 23, column 2: nimbus.host: &quot;master&quot;

平台:centos-6.3-i386 jdk-7u51 storm 0.9.1 python 2.6.6   hadoop 1.2.1 启动storm的时候,遇到这个问题,百度之后,看到大家的解决方案是在 nimbus.host: "master"前加上空格,但是,我的已经加上空格.还是出错. 1 # Licensed to the Apache Software Foundation (ASF) under one 2 # or more contributor license ag