Select options from JSON file I have JSON file with some id and value, and this need to be populated in form as select list:

$form['select_item'] = [
      '#type' =&gt; 'select',
      '#options' =&gt; $list,
      '#title' =&gt; $this-&gt;t('Choose'),
      '#required' =&gt; 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?
Drupal doesn't have a lot to help with this, it's really a general PHP task.

If you're determined to use the API for it, just load the file data in any way you like (fopen, file_get_contents, etc), and use Json::decode() to turn it into an array.