K
K
killboox2018-12-06 15:07:20
Python
killboox, 2018-12-06 15:07:20

How to remove extra characters and words in Json response in Python?

Hello, I'm Python full 0.
Please help
me as much as possible in json response in its pure form so that I have only this value in the output to the console, 1709967
but this value always changes
Answer:
{"status":{"success":1},"result":1709967}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gornostaev, 2018-12-06
@killboox

print(json_data['result'])

V
Vadim Shatalov, 2018-12-06
@netpastor

import json
response_data = '{"status":{"success":1},"result":1709967}'
response = json.loads(response_data)
result = response.get('result')

D
Dmitry Demidov, 2018-12-06
@ptitca_zu

If the desired value always lies in result
something like this

import json
json.loads(тут_ваш_ответ).get('result', 0)

B
bbkmzzzz, 2018-12-06
@bbkmzzzz

And this is how you can pull any value from the json response.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question