How to get data from Json Object using javascript [duplicate]

87
May 15, 2018, at 8:10 PM

This question already has an answer here:

  • Access / process (nested) objects, arrays or JSON 18 answers

I'm getting data as a json object

var data =  JSON.parse(JSON.stringify(data));
console.log(data);

On data console I got this. I want to get key and its value .

 {lobby: {…}}
 lobby:
 8jmb9ca3s04c8el4j5sf0d:"AD8BJBkMKCBoYg_qAAAB"
 38cjllj78cx0lic58ujxou:"PX51X9z_M34_9BvtAAAD"
 ba8gs1y8779kmakdapxk1:"UowsBDCCsZSpojzPAAAA"
Answer 1

Use

Object.keys(data);

to get all keys

and data.key or data['key'] to get its value.

READ ALSO
$_POST variable empty (with Ajax)

$_POST variable empty (with Ajax)

I've tried to add a lign a tab which add a row in a table (in database)I use jsgrid but I've a json error : when I try to execute PHP, I have an error on my prepare method (with the $_POST variable in the execute function)

60
Outputting javascript array values in a for loop results in undefined

Outputting javascript array values in a for loop results in undefined

I'm trying to use a loop to output values from two arrays on a jQuery hover functionOutside of the hover, I can access these array values fine but inside I get undefined

40
How to create regex to satisfy this condition “At least 1 letter and at least 1 number or symbol.” [on hold]

How to create regex to satisfy this condition “At least 1 letter and at least 1 number or symbol.” [on hold]

How to create regex to satisfy this condition "At least 1 letter and (at least 1 number or symbol)"

32
How to import Bootstrap 4 theme in Angular 4 or 4+ app

How to import Bootstrap 4 theme in Angular 4 or 4+ app

I'm new in learning AngularI have tried to import bootstrap 4 single page template in angular 4 This one: https://startbootstrap

103