DRAG DROP
-
Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a JSON string. Not all options are used.
DRAG DROP
-
Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a JSON string. Not all options are used.
annoys me that the second blank answer is ".encode" when the "." is already in the code snippet. But that's just bad question formatting. The given answer is still correct.
Given answer is correct >>>json.JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' https://docs.python.org/3/library/json.html
The provided Python code defines a dictionary named data containing various pieces of information. Then, it uses the json.JSONEncoder().encode() method to convert this dictionary into a JSON string representation. Finally, it prints the resulting JSON string.
Seems correct
correct