X
X
xomiles2021-06-13 17:30:59
Python
xomiles, 2021-06-13 17:30:59

How to compare elements in JSON?

For example, it gives me json with different elements:
This - {'update_id': 207133381, ' callback_query ': {'id': '43 .......
And this - {'update_id': 207391382, ' message ': {'message_id': 31 .......

How do I compare them? Like if in json callback_query , then display the number 1, and if message then 2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-06-13
@xomiles

Just through if
if 'callback_query' in obj

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question