How to write json in specific format in python -
i want display json in specific format , data database.so how form in specific format in python.format of json is
{ "data":{"device id" : value db,"date":current time}, "data": { "temperature": { value db }, "consumptions": { value db }, "error": [ { value db } ] } }
i have tried this:
dict((query.description[i][0], value) i, value in enumerate(row)) row in query.fetchall()
but i'm not getting desired output , i'm unable pass data json. how pass data json.
error im getting dictionay update sequence element 0# has length 1; 2 required
did use json
module?
import json print json.dumps(yourstructure, indent=6)
Comments
Post a Comment