Note that there are some explanatory texts on larger screens.

plurals
  1. POextract part of json into another object and keep link between both
    primarykey
    data
    text
    <pre><code>{    "data": [       {          "date": "2013-03-07",          "id": "2",          "vt_color": "#548dd4",          "vt_name": "follow up",          "duration": "20",          "time_booked": "12:00:00",          "stats": "booked",          "doctor_id": "00002",          "patient_id": "00003"       },       {          "date": "2013-03-08",          "id": "3",          "vt_color": "#76923c",          "vt_name": "ultrasound",          "duration": "30",          "time_booked": "08:00:00",          "stats": "booked",          "pt_name": "demo patien",          "dr_name": "Momen Alzalabany",          "doctor_id": "00002",          "patient_id": "00009"       }    ]  } </code></pre> <p>what i want is to create another array out of this including vt_name,vt_color and index of data so i use jquery</p> <pre><code>var words = []; $.each(arr['data'],function(ref){ words[this.doctor_id].push({name: this.vt_color,color: this.vt_name,index:ref}); }); console.log(koko); </code></pre> <p>FAIL : words[this.do_id] is not defined....</p> <p>how can i do this ? i want outcome to be</p> <p>sorry i'm a newbie with json/js</p> <p>i want outcome in php would be</p> <pre><code>['00002'=&gt;[ ['name'=&gt;'follow up','color'=&gt;'#548dd4',index=&gt;[0,3,4]], ['name'=&gt;'ultrasound','color'=&gt;'#769dd4',index=&gt;[1,5,8]] ] ] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload