How do I iterate through a JSON string and replace every ObjectId into Unix Epoch time for further processing?
What I know: You get the first 8 chars from an objectId with:
subStrObjectId = objectId.substring(0, 8);
5668d142a54cc4960b55ea19 --> 5668D142
and convert these from hexadecimal into an Int value (epoch time in milliseconds):
subStrObjectIdInDec = parseInt(subStrObjectId, 16);
5668D142 (hex) --> 1449709890 (dec)
my Json string:
myJsonString = [
[
{"_id":"5668d142a54cc4960b55ea19","cid":10851045,"temp":25.4},
{"_id":"5668d14ea54cc4960b55ea1a","cid":10850909,"temp":24.9}
],
[
{"_id":"5668d14fa54cc4960b55ea1b","cid":10851045,"hum":37.9},
{"_id":"5668d3108c8cda92074b7ec9","cid":10850909,"hum":39.6}
],
[
{"_id":"5668d3198c8cda92074b7ecb","cid":10851045,"lux":34},
{"_id":"5668d31e8c8cda92074b7ecc","cid":10850909,"lux":68}
]
];