I have JSON file with some id and value, and this need to be populated in form as select list:
$form['select_item'] = [
'#type' => 'select',
'#options' => $list,
'#title' => $this->t('Choose'),
'#required' => TRUE,
];
What is the best way to approach this. Can I somehow convert this JSON in array or something and use it in options?
I would like to have this values form JSON in separate file and to use it from there.
Any idea?