将php数组转换为javascript对象[关闭]

**My prevoius question changed **

My prevoius code in php

 Array
    (
        [0] => Array
            (
                [id] => 2000
                [title] => TIERE, DIANA
            )
        [1]  => Array
            (
               [id] => 1500
               [title] =>fhg , DIANA 
            )
    )

and in javascript , JSON.parse(obj) woked fine and it gives me an array of object like

  [
    0:object
    1:object
  ]

then i changed my php array to

 Array
    (
        [2000] => Array
            (
                [id] => 2000
                [title] => TIERE, DIANA
            )
        [1500]  => Array
            (
               [id] => 1500
               [title] =>fhg , DIANA 
            )
    )

but JSON.parse(obj) gives only one object in array lie as follows

[object]

My question is how to build json array in javascrip like as follows

   [
    2000: Object
    1500: Object
    800: Object
    500: Object
   ]

from a php array like this

Array
(
    [2000] => Array
        (
            [id] => 2000
            [title] => TIERE, DIANA
        )
    [1500]  => Array
        (
           [id] => 1500
           [title] =>fhg , DIANA 
        )
)

I think you can probably find a better solution than what you're trying to do using CSS, but I think this is what you're asking for:

var positions = new Array();
$('.icon').each(function() {
  var $icon = $(this);
  var left = $icon.css('left');
  if ($.inArray(left, positions)) {
    // yes, an icon already exists with this CSS left value.
    // I'm not sure what you intended to do about it.
    // maybe increment the alignment of this one?
    left = left + 2;
    $icon.css('left', left);
  }
  positions.push(left);
});