Website is upgrading. We will get back soon with latest updates. Thanks for your kind support.

Search

Suggested keywords:

Javascript object re-formatting

post-title

asj 4 hours ago.

I have data as follows:
{
   "2011":{
      "01":{
         "01":[
            {
               "date":"2011-01-01"
            },
            {
               "date":"2011-01-02"
            }
         ]
      },
      "02":{
         "01":[
            {
              
               "date":"2011-02-02"
            }
         ],
         "03":[
            {
               "date":"2011-02-15"
            },
            {                  
               "date":"2011-02-17"
            }
         ]
      }
   },
   "2012":{
      "01":{
         "01":[
            {
               "date":"2012-01-01"
            }
         ]
      },
      "03":{
         "01":[
            {
               "date":"2012-03-03"
            }
         ]
      }
   }
}
I need to construct final data in the below format:

[{year:2011,month:'Jan',week_no:1, week_total:2},
{year:2011,month:'Jan',week_no:2, week_total:2},
{year:2012,month:'Jan',week_no:1, week_total:1}
{year:2012,month:'Mar',week_no:1, week_total:1}]
Purpose is to obtain Year/Month / Week-wise totals. This data is required to plot some charts later. Help on this is highly appreciated..!..

You should write because you love the shape of Flow and sentences and the creation of different words on a page.
Social Media

Leave a Reply

Subscribe

to Our Newsletter