0

I'm newbie for json and python. So maybe it's a silly question, but I don't know the logic and don't understand from other posts.

I have this json file. I want to take "Apple M1" as a text with python.

In another answer, it uses index. I want to use key value which called "İşlemci Tipi" or id value "168". Because I need to count if I use index value.

json_data = {
      product: {
        attributes: [
          {
            key: { name: "İşlemci Tipi", id: 168 },
            value: { name: "Apple M1", id: 243383 },
            starred: true,
            description: "",
            mediaUrls: [],
          },
          {
            key: { name: "SSD Kapasitesi", id: 249 },
            value: { name: "256 GB", id: 3376 },
            starred: true,
            description: "",
            mediaUrls: [],
          }]
      }};
piseynir
  • 237
  • 1
  • 4
  • 14
  • 1
    That's not valid JSON -- there needs to be another set of `{}` around the dictionary. – Barmar Oct 13 '22 at 20:52
  • `data['product']['attributes'][0]['value']['name']` where `data` is the variable containing the decoded JSON. – Barmar Oct 13 '22 at 20:53

0 Answers0