I create jsonBlueprint to looks like :
const jsonBlueprint = {
"header": {
"FontSize": "2.5vw",
"TextColor": "#000000",
},
"freeT":{
"TextFontColor": "#000000",
"TextFontSize": "2vw"
}
So i can get that values pretty easy by freeT.TextFontColo etc.. How can i create Json function to set that values ?
I have something like that
function createJsonFile(template) {
const Json = {};
const inputs = [...template.querySelectorAll('.formInput')];
inputs.map(input => {
if (input.type != 'toggle') {
Json[input.name] = input.value;
} else {
Json[input.name] = input.checked;
}
});
return Json;
}
I want these values(from createJson class) refer to individual elements in blueprint and overwrite them. Actually in my finally Json i have bluePrint where i can see :
- header:
FontSize: "2.5vw",
TextColor: "#000000",
- FontSize:"2.5vw"
- TextColor:"#000000"
I want it to looks like :
- header:
FontSize: "2.5vw",
TextColor: "#000000"
and this values(fontsize,textcolor) should be overwrite by createJson function.
I tryied to change input.name to be like : header.FontSize but its just create :
- header:
FontSize: "2.5vw",
TextColor: "#000000",
-header.Fontsize:"2.5vw",