Solved

JSON Serialization in Python

Posted on 2006-11-17
8
1,443 Views
Last Modified: 2012-08-13
Hi,
Can someone give me a simple example how to use JSON serialization in Python?
0
Comment
Question by:jyotishb
8 Comments
 
LVL 17

Expert Comment

by:ramrom
ID: 17968362
If the silence continues it is probably due to the fact that we don't know what the question means. Of course if one of us does know then you are in luck. I Googled "JSON Serialization" so I at least now know what JSON is, but serialization???
0
 

Author Comment

by:jyotishb
ID: 17969542
well, JSON is a serialization  format, now if u ask me what does serialization means, then i guess i m asking the question in a wrong place .. :)
look here...

http://www.djangoproject.com/documentation/serialization/

0
 
LVL 17

Expert Comment

by:ramrom
ID: 17970018
So serialization is converting some data structure(s) to an ascii stream for transmission / storage. Similar to pickling or marshalling. JSON is a language with representations of dictionaries and lists almost identical to Python's represention of lists and dictionaries. JSON serializations is used e.g. by AJAX. Are we on the same page so far?

Are you looking for a 3rd party module/package that can be used from Python to perform this serialization?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Accepted Solution

by:
mish33 earned 250 total points
ID: 17970183
You have an example from http://www.djangoproject.com/documentation/serialization/#serialization-formats:

json_serializer = serializers.get_serializer("json")
json_serializer.serialize(queryset, ensure_ascii=False, stream=response)
0
 
LVL 14

Assisted Solution

by:RichieHindle
RichieHindle earned 250 total points
ID: 17979232
There's a Python JSON library here that should be what you're looking for: http://cheeseshop.python.org/pypi/simplejson
0
 
LVL 14

Expert Comment

by:RichieHindle
ID: 17986188
...and here are some examples of how to use simplejson: http://svn.red-bean.com/bob/simplejson/tags/simplejson-1.3/docs/index.html
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Merging two data frames and doing calculation 5 56
data scientists and AI 17 100
how to check case insensitive substring 5 53
object oriented programming comparison 5 52
Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a…
Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now