I'm having so much trouble with drupal 8 right now.
when in Drupal 7 I could do:
drupal_add_js("var a = 'b';");
and be done with it, for the life of my, I can't figure out how to attach data to a JS variable in Drupal 8
I had to write a custom THEME_preprocess_page function to add the JSON value to drupalSettings like this:
$variables['page']['content']['#attached']['drupalSettings']['customPricelist'] = $result;
but in reality the result get's escaped with quotation marks like:
and is not usable..