Passing parameters in css in Json?

Good day!
Please, read the JSON parameters width, height.
I these parameters to pass in CSS?

example:

{
 "global": [
{
 "id": "1",
 "width": "50",
 "height": "150"
},
{
 "id": "2",
 "width": "150",
 "height": "350"
},
{
 "id": "3",
 "width": "750",
 "height": "850"
}
]
}


How to put what I thought in CSS

.Layer + id{
 width: px; /* Width of block to insert what I believed */ 
 height: px; /* Height of block to insert what I believed*/ 
 }

either in html, instead of spaces that I believed from the file
<button style="height: px;width: px"></button>
April 4th 20 at 12:59
3 answers
April 4th 20 at 13:01
const all = {
 "global": [
{
 "id": "1",
 "width": "50",
 "height": "150"
},
{
 "id": "2",
 "width": "150",
 "height": "350"
},
{
 "id": "3",
 "width": "750",
 "height": "850"
}
]
};

for(item of all.global){
 let elm = document.querySelector('.layer' + item.id);
 elm.style.width = item.width + 'px';
 elm.style.height = item.height + 'px';
}
April 4th 20 at 13:03
the first method I'm not sure that is possible
and dynamically, something like this would:

jstr.global.forEach((a) => 
 document.querySelectorAll(".Layer + a.id").forEach((el) => 
 { el.style.width = a.width; el.style.height = a.height }))
April 4th 20 at 13:05
Does not want((((
And here it is
.Layer + id
what do you mean?
Layer1, or Layer2 + is a CSS adjacent sibling selector? - Clarabelle.Weissnat commented on April 4th 20 at 13:08

Find more questions by tags CSSJavaScriptJSON