2024-04-24 14:30:49 发布
网友
我如何解析JSON请求呢?在
{ "location_with_names": [ { "location_id": 101, "names": [ "a", "b", "c" ] }, { "location_id": 102, "names": [ "a", "e" ] }, { "location_id": 103, "names": [ "f", "c" ] } ] }
样本代码:
location_with_names为无
location_with_names
您必须首先反序列化它,然后才能查询它。您正在使用的函数用于else entirely。使用Request对象、bounded或{a3}上可用的stream选项。在
Request
stream
import json def on_post(self, req, resp): raw_data = json.load(req.bounded_stream) location_with_names = raw_data.get('location_with_names') print(location_with_names)
您必须首先反序列化它,然后才能查询它。您正在使用的函数用于else entirely。使用
Request
对象、bounded或{a3}上可用的stream
选项。在相关问题 更多 >
编程相关推荐