1

JSON result is coming as below.

{
  "id": 8,
  "name": "ads",
  "productCategoryMappings": [
    {
      "id": 3,
      "categoryId": 21,
      "productId": 8,
    }
  ]
}

How can I access categoryId in AJAX success

I can access result.name but can not access result.productCategoryMappings.categoryId

Prasad Telkikar
  • 15,207
  • 5
  • 21
  • 44
mohtashim
  • 11
  • 3
  • `result.productCategoryMappings` is an array. You need access it with index. For example: `result.productCategoryMappings[0].categoryId`. – Yong Shun Nov 11 '21 at 11:21

1 Answers1

1

try this

result.productCategoryMappings[0].categoryId
Serge
  • 40,935
  • 4
  • 18
  • 45