jquery - convert json to another json format -


i new json. having little trouble inconverting json 1 format format. json converted.

{     "message": "successfully advisor data has been fetched.",     "success": true,     "data": {         "dataheaders": ["carrier","b2b", "em"],             "dataarray": {             "dhl": ["dhl", "45", "5","5"],             "fedex": ["fedex","40", "7","6"],             "ups" : ["ups","30", "10","3"],             "tnt" : ["tnt","30", "10","3"],         }     } } 

i require json converted format.

[   {   "key":"carrier",   "values":[      {         "x":"dhl",         "y":45      },      {         "x":"fedex",         "y":40      },      {         "x":"ups",         "y":30      },      {         "x":"tnt",         "y":35      }   ] }, {    "key":"b2b",   "values":[      {         "x":"dhl",         "y":5      },      {         "x":"fedex",         "y":7      },      {         "x":"ups",         "y":10      },      {         "x":"tnt",         "y":5      }    ] },  {    "key":"em",   "values":[      {         "x":"dhl",         "y":5      },      {         "x":"fedex",         "y":6      },      {         "x":"ups",         "y":3      },      {         "x":"tnt",         "y":5      }   ] } ] 

how can using jquery?

use var obj = jquery.parsejson() parse input string. can access fields via obj.[fieldname] , build outputstring.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -