

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to print Python dictionary into JSON format?
JSON stands for Javascript Standard Object Notation. Python module called json is a JSON encoder/decoder. The dumps() function in this module returns a JSON string representation of Python dictionary object.
D1={"pen":25, "pencil":10, "book":100, "sharpner":5, "eraser":5} >>> import json >>> j=json.dumps(D1) >>> j '{"pen": 25, "pencil": 10, "book": 100, "sharpner": 5, "eraser": 5}'
- Related Questions & Answers
- How can I convert a bytes array into JSON format in Python?
- How to create Python dictionary from JSON input?
- How to print a Python dictionary randomly?
- How to convert Python date in JSON format?
- Python - Convert flattened dictionary into nested dictionary
- Python Convert nested dictionary into flattened dictionary?
- How to print the largest value from Python dictionary?
- How to Pretty print Python dictionary from command line?
- How to insert new keys/values into Python dictionary?
- How to convert JSON data into a Python object?
- How to convert JSON data into a Python tuple?
- How to format JSON string in JavaScript?
- How can I represent python tuple in JSON format?
- How we can translate Python dictionary into C++?
- Python - Convert a set into dictionary
Advertisements