-2

I am building one application in Angular and I have to fetch some data from API, but I only want a specific part from that nested JSON response. This is a json:

{
   “current_data”: 1,
   “fields”: [
      {
        “id”: 3,
        “title”: base,
      },
      {
        “id”: 4,
        “title”: base,
      },
      {
        “id”: 5,
        “title”: base,
      }
   ],
   “first_url”: “http://99.22.11”,
   “page”: 1

}

I need only "fields" and I don't want other properties. How can I extract only "fields" and display it to user? Thanks!

d1rc
  • 1

1 Answers1

0

If your response is in an object called foo, you can access fields by using foo.fields

Evert
  • 93,428
  • 18
  • 118
  • 189