-2

I am using Python 2.7.11 and Django 1.10.2. How do I get JSON data in Django views. I have tried for two days but I only get only List data.

This is my example, I need the "parent" data.

 [
   {
    "url": "",
    "category_image": [],
    "price_rule": null,
    "parent": {
      "id": 12,
      "category_image": [],
      ........
    },
    "name": "cat2",
    "slug": "cat2",
    .........
  },
] 
Tom
  • 1,636
  • 2
  • 13
  • 21

1 Answers1

0

If you want get parent data, you can do something like this:

    id = list_data[0]['parent']['id']

This should return 12. If you want category_image, you can try:

    category = list_data[0]['parent']['category_image']

If i understand your question correctly, this is your answer.

Vladyslav Moisieienkov
  • 4,118
  • 4
  • 25
  • 32