Python中文
首页
教程
问答
标签
搜索
登录
注册
JSON架构:输入格式不正确
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我使用的是基于jsonschema的Tornado_JSON,我的模式定义有一个问题。{1}似乎在联机修复问题。<code>True</code>加大写<code>T</code>适用于python,并导致在线验证器(<code>Schema is invalid JSON.</code>)中的错误。有了<code>true</code>,在线验证器很高兴,示例json根据模式进行验证,但是我的python脚本不再启动(<code>NameError: name 'true' is not defined</code>)。这能解决吗?在</p> <pre><code>@schema.validate( """input_schema={ 'type': 'object', 'properties': { 'DB': { 'type': 'number' }, 'values': { 'type': 'array', 'items': [ { 'type': 'array', 'items': [ { 'type': 'string' }, { 'type': [ 'number', 'string', 'boolean', 'null' ] } ] } ], 'additionalItems': true } } }, input_example={ 'DB': 22, 'values': [['INT', 44],['REAL', 33.33],['CHAR', 'b']] }""" ) </code></pre> <p><em>我根据您的评论更改了它(</em><strong><em>外部文件json.loads()</em></strong><em>)。很 完美。非常感谢。</em></p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>将模式放入三引号字符串或外部文件中,然后使用<code>json.loads()</code>对其进行解析。使用小写拼写。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
Python中是否有类似Clojure的线程宏?
3 回答
Python中是否有类似JPanel的组件?
9 回答
Python中是否有类似MATLAB的vpasolve的等价解算器
1 回答
python中是否有类似NLTK的东西不需要安装?
4 回答
python中是否有类似osgi在java中试图解决的需求?
2 回答
python中是否有类似PAM的模块?
8 回答
Python中是否有类似Perl的Data::Dumper的工具用来检查数据结构?
10 回答
python中是否有类似robocy的函数,带有重试选项?
8 回答
Python中是否有类似Rstudio的帮助部分?
8 回答
python中是否有类似ruby的索引方法?
7 回答
python中是否有类似于“perlpe”选项的内容?
2 回答
Python中是否有类似于C++ STL映射的结构?
10 回答
python中是否有类似于C中预处理器行为的工具?
8 回答
Python中是否有类似于Harmony的let关键字的内容?
9 回答
python中是否有类似于matlab中fzero的函数?
9 回答
python中是否有类似于MATLAB中peaks(N)的函数/实现?
2 回答
Python中是否有类似于Matlab的deconvblind的函数?
3 回答
Python中是否有类似于Perl中“想要”的东西
5 回答
Python中是否有类似于Perl正则表达式中的"local"变量?
2 回答
python中是否有类似于php的$$变量的语法
9 回答