Include Json file into Twig template
You need use hook_page_attachments_alter

function mytheme_page_attachments_alter(&amp;$attachments){
  $attachments['#attached']['html_head'][] = [
    // The data.
    [
      '#type' =&gt; 'html_tag',
      // The HTML tag to add, in this case a  tag.
      '#tag' =&gt; 'script',
      // set attributes like src to load a file
      '#attributes' =&gt; array('src' =&gt; '/themes/mytheme/assests/js/particles.json'),

    ]
  ];

}