标签: jquery python json
如何使用python将JSON对象转换为字符串。任何人都可以帮忙吗?我需要将此对象转换为字符串。
products = [ {'id':01,'description':'Hair tonic','price':'$20'}, {'id':02,'description':'Hair Shampoo','price':'$25'}, {'id':03,'description':'Hair Comb','price':'$10'}, ]
答案 0 :(得分:2)
import json json.dumps(products)
http://docs.python.org/2/library/json.html