Which Python json call serializes the Devices object to a JSON-formatted string?
Choose an answer
Tap an option to check your answer.
Correct answer: json.dumps(Devices).
Why this is the answer
The json.dumps() function is correct because it serializes a Python object (like the Devices object) into a JSON-formatted string. The 's' in dumps stands for "string." json.repr(Devices) is incorrect; repr() is a built-in Python function for creating a string representation of an object, not for JSON serialization. json.loads(Devices) is incorrect; loads() deserializes a JSON-formatted string into a Python object. The 's' in loads also stands for "string," but it performs the opposite operation of dumps(). json.print(Devices) is incorrect; there is no standard json.print() function in the Python json library.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed