-1

For example, if I have JSON file like:

{
"update" : {
   "email@gmail.com":{
        "1234": {"notfication": "This is testing 1","url": "http://example1.com"},
        "4567": {"notfication": "This is testing 3","url": "http://facebook.com"}
                  },
  "testing@gmail.com":{
        "abcd": {"notfication": "This is testing 1","url": "http://example2.com"},
        "efgh": {"notfication": "This is testing 3","url": "http://facebook.com"}
                  }
}
}

Is it possible to ask the server to return the text: "email@gmail.com" and "testing@gmail.com"?

Thank you

zZPrank
  • 1
  • 3

1 Answers1

0
var obj = {
                        "update" : {
                               "email@gmail.com":{
                                    "1234": {"notfication": "This is testing 1","url": "http://example1.com"},
                                    "4567": {"notfication": "This is testing 3","url": "http://facebook.com"}
                                              },
                              "testing@gmail.com":{
                                    "abcd": {"notfication": "This is testing 1","url": "http://example2.com"},
                                    "efgh": {"notfication": "This is testing 3","url": "http://facebook.com"}
                                              }
                            }
                            };


                var keys = Object.keys(obj.update);
                console.log(keys[0]);
                console.log(keys[1]);

Also see Ranga's answer here.

Prashant Saraswat
  • 838
  • 1
  • 8
  • 20