The json module is a good solution here. It has the advantages over pickle that it only produces plain text output, and is cross-platform and cross-version.
import json
json.dumps(dict)
More Related Contents:
- How to make a class JSON serializable
- Split / Explode a column of dictionaries into separate columns with pandas
- Access a particular field in arbitrarily nested JSON data [duplicate]
- How to get string objects instead of Unicode from JSON?
- Making object JSON serializable with regular encoder
- Converting dictionary to JSON
- How to JSON serialize sets?
- Serializing class instance to JSON
- How to convert an XML string to a dictionary?
- Storing Python dictionaries
- How I can I lazily read multiple JSON values from a file/stream in Python?
- In Python, how can you load YAML mappings as OrderedDicts?
- How can I access the nested data in this complex JSON, which includes another JSON document as one of the strings?
- String to Dictionary in Python [duplicate]
- How to dump a dict to a JSON file?
- django-rest-framework 3.0 create or update in nested serializer
- How do I serialize a Python dictionary into a string, and then back to a dictionary?
- Flask jsonify a list of objects
- Why do I get an error “‘unicode’ object does not support item deletion” when trying to delete values from a JSON object?
- How to json_normalize a column with NaNs
- Serialising an Enum member to JSON
- python: read json and loop dictionary
- JSON dumps custom formatting
- JSON object must be str, bytes or bytearray, not dict
- How to completely traverse a complex dictionary of unknown depth?
- List of objects to JSON with Python
- TypeError: Object of type ‘bytes’ is not JSON serializable
- Pretty print JSON dumps
- Json Encoder AND Decoder for complex numpy arrays
- Why do I get an error “‘str’ object does not support item deletion” when trying to delete values from a JSON object?