How to convert an array in a JSON string to a list in Python

Converting an array in a JSON string to a list returns the array contained within the JSON string as a list. For example, converting the array in ‘{“fruits”: [“apple”, “banana”, “orange”]}’ to a list results in [“apple”, “banana”, “orange”].

Solution for How to convert an array in a JSON string to a list in Python : You can use json.loads() to convert an array in a JSON string to a list Call json.loads(json_string) to convert json_string to a dictionary object. Index the dictionary with the syntax json_object[key] to return the list stored at the index key.


how-to-convert-an-array-in-a-json-string-to-a-list-in-python