I am using python. eg, this is one line from the file:
{
"name": "accelerator_pedal_position",
"value": 0,
"timestamp": 1364310856.002000
}
I am using python. eg, this is one line from the file:
{
"name": "accelerator_pedal_position",
"value": 0,
"timestamp": 1364310856.002000
}
Use the datetime
module
In [1]: import datetime
In [2]: timestamp = 1364310856.002000
In [3]: print datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
2013-03-26 23:14:16
If your json file contents only one line, you can try:
In [1]: import json
In [2]: import datetime
In [3]: with open(r'yourjsfile','r') as fh:
...: jsfile = json.load(fh)
...: ts = jsfile['timestamp']
...: print datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
...:
2013-03-26 23:14:16