Monday, April 17, 2017

I just love JSON ;-)

I'm keeping "diary", so place where I put some thoughts and things I'm thankful.
I have my own program to keep it, but earlier I used to use Narrate.

And this was only cause to keep Narrate still on my phone*. 
So yesterday in night I exported all notes from Narrate to Google Drive.
I exported also file in which I keep diary items for my current program..

And thanks to this that this is JSON I was able to add those old notes from Narrate to my Diary ;-)

I needed just to add in my Python program this lines:


import json
diary = json.load(open("diary.json"))

and I had access to my file :-)
Latter I needed only to add new items to diary, sort it, and save it with:



json.dump(diary,open("new_diary.json","w+"))

With some binary format it would be also possible but more complicated.

With JSON it was easy :-)

As I wrote, I just love JSON ;-)

* - it is Nexus 6, and is becoming very, very slow, and I still hope that uninstalling not needed apps will make it faster ;-)


Similar postsbeta
Blindfold programming
Why it isn't working???
Which language is fastest? ;-)
How to get negative number from size() in LinkedList in Java? ;-)
My road to automation ;-)

No comments:

Post a Comment