只是想弄清楚我从Vend JSON API得到的JSON输出:
Item pagination
Item {u'pages': 10, u'results': 487, u'page_size': 50, u'page': 1}
Item customers
Item [{u'custom_field_3': u'', u'customer_code': u'WALKIN', u'custom_field_1': u'', u'balance': u'0', u'customer_group_id': u'xxx', u'custom_field_2': u'',
就是一个例子。在
我试图从JSON输出中分离出一些字段,比如“customer_code”,但似乎还没有完全解决。在
我的代码:
^{pr2}$如果我可以“遍历”JSON输出,隔离相关字段,那将是非常好的代码。在
根据输出和给定代码,数据结构为:
要获取客户代码列表,您需要使用键
^{pr2}$customers
访问dict条目并对其进行迭代:相关问题 更多 >
编程相关推荐