Answer the question
In order to leave comments, you need to log in
Telegram bot in python. How to write an incoming json subobject to a dictionary?
I am writing a cart bot using the telebot library. Depended on the implementation of one function for it. Bottom line: I send him audio recordings, he must copy all the data from the 'audio' json object into a python dictionary to write to a file. Tried like this, data.append(message.audio)
but it throws an error:
TypeError: Object of type Audio is not JSON serializable
Answer the question
In order to leave comments, you need to log in
You need to look at the type Audio
, and what method to get dict-like information from it.
To the extreme, you can use__dict__
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question