- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 convert JSON data into a Python object?
The following code converts a json object(string) into a python object(dictionary). We import the json module and use the json.loads() method to do this.
Example
import json json_string = '{"name":"Sonali", "age": 21, "designation":" Software developer"}' print type (json_string) def func(strng): a =json.loads(strng) print type(a) print a func(json_string)
output
<type 'str'> <type 'dict'> {u'age': 21, u'name': u'Sonali', u'designation': u'Software developer'}
- Related Articles
- How to convert JSON data into a Python tuple?
- How to convert a JSON string into a JavaScript object?
- Strip quotes with JavaScript to convert into JSON object?
- How to convert a date object's content into json in JavaScript?
- How to convert JSON text to JavaScript JSON object?
- Python - Ways to convert string to json object
- How to deserialize a JSON into Javascript object?
- How we can convert Python objects into JSON objects?
- How can we convert a JSON string to a JSON object in Java?
- How to transform JSON text into a JavaScript object?
- How can I convert a bytes array into JSON format in Python?
- How to convert JSON string into Lua table?
- How to convert an integer into a date object in Python?
- How to convert a Map to JSON object using JSON-lib API in Java?
- How to convert JSON results into a date using JavaScript?

Advertisements