Trouble converting php array to json format slightly wrong -


i'm having trouble getting correct json format following php array

array (     [0] => array         (             [name] => name1             [data] => array                 (                     [0] => array                         (                             [5] => 2013-15-6,9                             [6] => 2013-15-7,9                             [7] => 2013-15-8,9                             [8] => 2013-15-9,9                             [9] => 2013-15-10,9                             [10] => 2013-15-11,9                             [11] => 2013-15-12,9                         )                  )          )  ) 

encoding json outputs

[     {         "name": "name1",         "data": [             {                 "5": "2013-15-6,9",                 "6": "2013-15-7,9",                 "7": "2013-15-8,9",                 "8": "2013-15-9,9",                 "9": "2013-15-10,9",                 "10": "2013-15-11,9",                 "11": "2013-15-12,9"             }         ]     } ] 

what need json output below, removing curly brackets inside data array , remove index numbers thought don't think that's possible.

[     {         "name": "name1",         "data": [             "2013-15-11,9",             "2013-15-12,9"         ]     } ] 

i've tried different combinations of array() around variables got me close enough adding bracket inside data array can't rid of curly brackets. appreciate help, have been working on few hours. thanks

i took json output expecting , did json_decode on it, that's result:

array (     [0] => stdclass object         (            [name] => name1            [data] => array                 (                     [0] => 2013-15-11,9                     [1] => 2013-15-12,9                 )          )  ) 

so that's how php structure should before sending json_encode.

p.s. checked json_encode (reversed process) , returns need.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -