The json.dumps() function is used to convert a Python object into a JSON string 1 . It takes Python data as its argument, such as a dictionary or a list, and returns a JSON string.
[Reference: Official Python documentation on json.dumps(): https://docs.python.org/3/library/json.html#json.dumps, , A. It returns a JSON string., This statement is true because the json.dumps () function takes a Python object as its argument and returns a JSON-formatted string that represents the object. For example, json.dumps ([1, 2, 3]) returns ‘[1, 2, 3]’., D. It takes Python data as its argument., This statement is true because the json.dumps () function accepts any Python object that can be serialized into JSON, such as lists, dictionaries, strings, numbers, booleans, or None. For example, json.dumps ({“name”: “Alice”, “age”: 25}) returns ‘{“name”: “Alice”, “age”: 25}’., ]
Submit