1
[
  {
    "docId": "58d8f38cd2f554fdfca4fd18",
    "__v": 8,
    "clinicDetails": {
      "5908e342236dee7e7364698e": {
        "appointmentSlots": {
          "sat": {
            "5908e342236dee7e73646a44": {
              "bookFlag": true,
              "endTime": "07:00PM",
              "startTime": "06:30PM"
            },
            "5908e342236dee7e73646a43": {
              "bookFlag": true,
              "endTime": "06:30PM",
              "startTime": "06:00PM"
            },
.......

full file : https://docs.google.com/document/d/1FK1NEY1Vmjzv2gBtleFquA0VMpfYGf9FaMyblPr8vws/edit?usp=sharing

I need to access these appointment slot ids like 5908e342236dee7e73646a44, so that I can send it in an API request

I am using angular.

anoop
  • 3,812
  • 2
  • 16
  • 28
boy man
  • 111
  • 1
  • 10

1 Answers1

1

Try to use

var jsonObject = angular.fromJson(yourJsonString)

That will transform your Json to an object. Then you can iterate over any field of the object an get keys or values.

angular.forEach(jsonObject.whatever, function(value, key) {
  console.log('key : ', key);
  console.log('value : ', value);
});
Bibzer
  • 264
  • 2
  • 4