Developing Applications and Automating Workflows Using Cisco Platforms (DEVASC) — Question 265

Which Python function is used to parse a string that contains JSON data into a Python dictionary?

Answer options

Correct answer: D

Explanation

The correct function is json.loads(), which specifically reads a JSON-formatted string and converts it into a Python dictionary. The other options do not perform this function: json.dumps() serializes a Python object to a JSON string, json.to_json() is not a valid function, and json.parse() is not a function in the Python JSON module.