I have got a functional bit of javascript that consists of an item literal. But I have to localize it, and I am ytrying to learn how to rewrite it to ensure that I'm able to get wordpress_localize_script() to accet it, and output the right format.

The non-localized (non dynamic) version appears like this:

var layoyt_config = {
    'header'        : 1 
,   'footer'        : 1
,   'ls'            : {'sb1':1}
,   'rs'            : {'sb1':1,'sb2':1}
,   'align'         : 'center'
};  

Now, to possess individuals values produced by php (according to some wordpress_configurations) I wish to use wordpress_localize_script, in order to take over from there:

var layoyt_config = my_localized_data.layoyt_config;

And also to have that data directly into that object property I 'thought' I possibly could do that, but clearly not:

$data = array(
    'layout_config' => {
        'header' : 1
    ,   'footer' : 1
    ,   'ls' : {'sb1': 1}
    ,    'rs' : {'sb1': 1,'sb2': 1}
    ,    'align' : 'center'
    }
);
wp_localize_script('my-script-handle', 'my_localized_data', $data);

As this makes PHP parse error I have attempted to rewrite the json to array syntax, as wordpress_localize_script will convert that to object notation, but this doesn't work for me personally:

$data = array(
    'layout_config' => array(
        'header' => 1
    ,   'footer' => 1
    ,   'ls' => array('sb1'=>1)
    ,    'rs' => array('sb1'=>1,'sb2'=>1)
    ,    'align' => 'center'
    )
);
wp_localize_script('my-script-handle', 'my_localized_data', $data);

Even though this runs easily trhough the php parser, I don't obtain the expected output during my page source, as my_localized_data.layout_config turns into a String "Array", this is actually the output:

<script type='text/javascript'>
    /* <![CDATA[ */
    var wpkit_localized_data = {
    layout_config: "Array"
    };
    /* ]]> */
</script>

So.. How do i do that (or will i have to believe that I have to 'flatten' my object into discrete vars like:

lc_header = '1';
ls_ls_sb1 = '1';
etc...