Answer the question
In order to leave comments, you need to log in
What is the correct way to insert values into JSON?
There is a very long JSON part of the key-values from which I now take from somewhere outside and just paste everything in the manner: "data":{"client_id":' + config['client_id'] + '
When there are a lot of values, it becomes inconvenient to use. Maybe there are some better options?
Answer the question
In order to leave comments, you need to log in
Obviously, you need to use the json
module specially designed for this , which is included in the standard library:
import json
json_str = json.dumps({ 'data': config })
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question