I have the following file "data.JSON" and I wish to loop through the JSON file and filter data based on dates. For example
data.JSON:
[{"EngComment":"test, <br> <br>5/10/2021 6:33:6 luisdomi"},
{"EngComment":" "},
{"EngComment":" "},
{"EngComment":"test, <br> <br>5/25/2021 17:24:20 luisdomi"},
{"EngComment":" "}
]
I am kind of new to Java Script and also have trouble declaring it on a separate script file
var json = data.json
for(var i = 0; i < json.length; i++) {
var obj = json[i];
if(timenow - obj <72 hours){
json[i] = ""
}
}
//save the file if possible
so the new JSON file is now:
[{"EngComment":""},
{"EngComment":" "},
{"EngComment":" "},
{"EngComment":""},
{"EngComment":" "}
]