
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How I can dump a Python tuple in JSON format?
JSON stands for Javascript object notation. It is a lightweight, language-independent data interchange format. Python library has json module that provides functions for json encoding and decoding.
The dumps() function converts a Python object to JSON format
>>> T1=(12, "Ravi", "B.Com FY", 78.50) >>> import json >>> str1=json.dumps(T1) >>> str1 '[12, "Ravi", "B.Com FY", 78.5]'
- Related Articles
- How can I represent python tuple in JSON format?
- How can I convert a bytes array into JSON format in Python?
- How can I append a tuple into another tuple in Python?
- How can I subtract tuple of tuples from a tuple in Python?
- How can I use Multiple-tuple in Python?
- How can I define duplicate items in a Python tuple?
- How can I do Python Tuple Slicing?
- How can I create a non-literal python tuple?
- How I can convert a Python Tuple into Dictionary?
- How can I convert a Python tuple to string?
- How can I preserve Python tuples with JSON?
- How can I convert Python strings into tuple?
- How can I create a Python tuple of Unicode strings?
- How can I remove items out of a Python tuple?
- How can I convert a Python tuple to an Array?

Advertisements