How to I parse JSON list of dictionaries in javascript -


i'm new javascript , need iterate through json list of dictionaries create list each key.

here's json:

[     {         "date": "aug. 14, 2015",         "reel": "reel 1",         "job": "color correction",         "status": "in progress",         "completion": "60"     },     {         "date": "aug. 14, 2015",         "reel": "reel 1",         "job": "conform",         "status": "in progress",         "completion": "70"     },     {         "date": "aug. 14, 2015",         "reel": "reel 2",         "job": "scanning",         "status": "complete",         "completion": "100"     },     {         "date": "aug. 12, 2015",         "reel": "reel 1",         "job": "qc only",         "status": "in progress",         "completion": "50"     } ] 

i'm using function read in json:

$.getjson('cgi-bin/fakedata.txt', function(main) 

i want able access main['date'] = ['august 12, 2015','august 14, 2015']

etc...

below runnable node program. looked me trying dates separate array. access them dates[0].

#!/usr/bin/node  json = [     {         "date": "aug. 14, 2015",         "reel": "reel 1",         "job": "color correction",         "status": "in progress",         "completion": "60"     },     {         "date": "aug. 14, 2015",         "reel": "reel 1",         "job": "conform",         "status": "in progress",         "completion": "70"     },     {         "date": "aug. 14, 2015",         "reel": "reel 2",         "job": "scanning",         "status": "complete",         "completion": "100"     },     {         "date": "aug. 12, 2015",         "reel": "reel 1",         "job": "qc only",         "status": "in progress",         "completion": "50"     } ];   function getdates(main) {     dates = [];     (var = 0; < main.length; i++ ) {         dates.push(main[i].date);     }     return dates; };  dates = getdates(json); console.log(dates); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -