-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.js
28 lines (25 loc) · 679 Bytes
/
load.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async function loadData(){
const pickerOpts = {
types: [
{
description: "Json",
accept: {
"json/*": [".json"],
},
},
],
excludeAcceptAllOption: true,
multiple: false,
};
const [fileHandle] = await window.showOpenFilePicker(pickerOpts);
const file = await fileHandle.getFile();
let text = await file.text()
let obj = JSON.parse(text)
for (let [key, data] of Object.entries(obj)) {
let CurrentEntry = document.getElementById(key);
if (key.includes("checkbox")){
CurrentEntry.checked = data;
} else{CurrentEntry.value = data.replace("<", "")};
ausw()
}
}