0

I want to remove some characters in the json datas that I got.

my desired output is like this

uploads/8ca8672f4cfb4b31bf39db344a05055a.jpeg

but I'm getting is this

{'image_url': 'uploads/8ca8672f4cfb4b31bf39db344a05055a.jpeg'}

this is my code

people_string = '''
{
  "event": "account_aprroved",
  "payload": {
  "images": [
  {
    "image_url": "uploads/8ca8672f4cfb4b31bf39db344a05055a.jpeg"
  },
  {
    "image_url": "uploads/7de53d084e5d441fa530f4d5ea9bb3ec.jpeg"
  }
],
},
}

data = json.loads(people_string)
for person in data['payload']['images']:
        print(person)
YnotCoding
  • 47
  • 9

2 Answers2

4

Try accessing the image_url field of each person:

data = json.loads(people_string)
for person in data['payload']['images']:
    print(person['image_url'])
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
0

Try print (person['image_url'])

Pierre
  • 163
  • 1
  • 9