nerdexam
Cisco

350-401 · Question #1190

Drag and Drop Question 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. Answer:

The correct answer is JSONEncoder; .encode; data. To convert a Python object into a JSON string, you use json.JSONEncoder().encode(data). The JSONEncoder class is Python's built-in JSON encoder, and calling .encode(data) on an instance of it serializes the Python object (data) into a JSON-formatted string. This is the standard p

Submitted by priya_blr· Mar 6, 2026Python Programming Fundamentals - Working with Data Formats and Serialization (JSON handling using the `json` standard library module)

Question

Drag and Drop Question 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. Answer:

Exhibit

350-401 question #1190 exhibit

Answer Area

Drag items

JSONEncoderdatadecodeJSONDecoder.encode

Correct arrangement

  • JSONEncoder
  • .encode
  • data

Explanation

To convert a Python object into a JSON string, you use json.JSONEncoder().encode(data). The JSONEncoder class is Python's built-in JSON encoder, and calling .encode(data) on an instance of it serializes the Python object (data) into a JSON-formatted string. This is the standard pattern for manually encoding Python objects to JSON using the json module.

Topics

#JSON serialization#Python json module#JSONEncoder#data encoding

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice