Solved

JSON Serialization in Python

Posted on 2006-11-17
8
1,452 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Dictionaries contain key:value pairs. Which means a collection of tuples with an attribute name and an assigned value to it. The semicolon present in between each key and values and attribute with values are delimited with a comma.  In python we can…
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
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…

860 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