API EXPORT JSON Formatting

API EXPORT JSON Formatting


I have successfully setup a API call to export data from an Analytics report table. I am using JSON format for the export.

But the JSON formatting is not as expected. I would like to see the column names included as true JSON key / value pairing format, and not have the column names shown above as in the column_order field.

Current output

{
   "response":
   {
      "uri":"\/api\/dfgdsfjdfsdfjgdf",
      "action":"EXPORT",
      "result":
	{
	   "column_order":["Market_Day","Stalls"],
	   "rows":[
	             ["April 06th ","62"],
		     ["April 14th ","82"],
                  ]
	}
    }
}
Required Format
{
   "response":
   {
      "uri":"\/api\/sdgdfgdfgfdg",
      "action":"EXPORT",
      "result":
	{
	   "rows":[
              {
                  "Market_Day" : "April 06th ",
                  "Stalls" : "62"
              },
              {
                  "Market_Day" : "April 14th ",
                  "Stalls" : "82"
              }
	    ]
	}
    }
}
How do I make it do this type of formatting.

Thanks