Q:

wp_localize_script -> need to pass "[0,6]" to JS

I am working on a plugin. I use "wp_localize_script" to pass variables to JS. All in all I'm passing 16 variables. All of them work, except one and I need assistance to get it work...
Originally the JS-code-line would look like this:
hiddenDays: [0,6],

If I configure the variable in PHP statically like this, the variable gets passed to JS fine:
$settings = array(
  'hiddenDays' => [0,6]
);

wp_localize_script( 'settings', 'js_x_vars' , $settings );

Now I try it somehow like this:
$db_value = "0,6"; // Would originally be retrieved from database
$hiddendays = "[" . $db_value . "]";

$settings = array(
  'hiddenDays' => $hiddendays
);

wp_localize_script( 'settings', 'js_x_vars' , $settings );

This doesn't work and I tried a lot of similar variations. I also tried to set the brackets in JS and pass only the numbers ...
In Browser-source I see, that there is a unwanted line-break:

EDIT:
As recommended I have tried now to pass the Array directly like this:
$db_value = "0,6"; // Would originally be retrieved from database

$settings = array(
  'hiddenDays' => array($db_value)
);

wp_localize_script( 'settings', 'js_x_vars' , $settings );

This doesn't work either ...
It would be working like this:
'hiddenDays' => array(0,6)

EDIT2:
As recommended I have also tried to pass it as actual Array:
$db_value = "0,6";
$db_value = explode(',', $db_value);
$settings = array(
   'hiddenDays' => $db_value
);

This doesn't work either and results in the following:

EDIT3:
My JS Knowledge is very limited and I am not able to debug in JS. I managed to output a console.log(js_x_vars.hiddenDays). I think this could be helpful. Please have a look at the following Image:

How to get around this?
Thank you

A:

I finally figured it out on my own ...
Building the array as recommended with explode:
$db_value = "0,6";
$db_value = explode( ',', $db_value );

The Result of "var_dump( $dbvalue )":
array(2) { [0]=> string(1) "0" [1]=> string(1) "6" } 

Now the solution:
$db_value = "0,6";
$db_value = array_map( 'intval', explode( ',', $db_value ) );

The Result of "var_dump( $dbvalue )":
array(2) { [0]=> int(0) [1]=> int(6) }

