Explain JSON dumps() in Python with example

The json.dumps() function in Python is used to convert a dictionary object into a string in the JSON data format. This can be useful when you need to represent the data in the dictionary as a string for tasks such as parsing or printing. The function returns a JSON string representation of the dictionary, which can be easily stored or transmitted.