How to update json file with python

This is the place for queries that don't fit in any of the other categories.

How to update json file with python

Postby tbaror » Tue Aug 20, 2013 7:13 pm

Hello All,

I have python utility i wrote that doing some WMI monitoring, the the data is written in that format


Code: Select all
CPU = [{'TS':'2013:12:03:30','CPUVALUES':['0','1','15']}]

Now i need occasionally update data that will look eventually like following

Code: Select all
 CPU = [{'TS':'2013:12:03:30','CPUVALUES':['0','1','15']},{'TS':'2013:14:00:30','CPUVALUES':['0','75','15']}]

Any suggestion how to accomplish that
Please advice
Posts: 17
Joined: Sun Jul 07, 2013 8:06 pm

Re: How to update json file with python

Postby micseydel » Tue Aug 20, 2013 9:10 pm

If you don't mind having double instead of single quotes, the builtin json module rocks.

If you want more help than us saying what the name of a module, I recommend you post some code attempt at solving your problem and ask as specific of questions as you want answers.
Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2252
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 5 guests