<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JSON Encoding and Decoding with Custom Objects in Python</title>
	<atom:link href="http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/</link>
	<description></description>
	<lastBuildDate>Sat, 09 Jan 2010 01:06:08 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Parag Shah</title>
		<link>http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/comment-page-1/#comment-763</link>
		<dc:creator>Parag Shah</dc:creator>
		<pubDate>Sat, 08 Aug 2009 09:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quaternio.net/?p=355#comment-763</guid>
		<description>Hi Jessy,

Here&#039;s how I was able to use the custom encoder. Not sure if it is the best way though...

http://blog.adaptivesoftware.biz/2009/08/custom-json-encoder-in-django.html</description>
		<content:encoded><![CDATA[<p>Hi Jessy,</p>
<p>Here&#8217;s how I was able to use the custom encoder. Not sure if it is the best way though&#8230;</p>
<p><a href="http://blog.adaptivesoftware.biz/2009/08/custom-json-encoder-in-django.html" rel="nofollow">http://blog.adaptivesoftware.biz/2009/08/custom-json-encoder-in-django.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Parag Shah</title>
		<link>http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/comment-page-1/#comment-737</link>
		<dc:creator>Parag Shah</dc:creator>
		<pubDate>Thu, 06 Aug 2009 18:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quaternio.net/?p=355#comment-737</guid>
		<description>Hi Jessy,

Thanks for the response. I tried passing my custom encoder with the cls parameter as suggested, but I got an error msg:

dump() got multiple values for keyword argument &#039;cls&#039;

I will figure out the correct way to do this and post it back here.

Thanks for taking the time to help me.

--
Regards
Parag</description>
		<content:encoded><![CDATA[<p>Hi Jessy,</p>
<p>Thanks for the response. I tried passing my custom encoder with the cls parameter as suggested, but I got an error msg:</p>
<p>dump() got multiple values for keyword argument &#8216;cls&#8217;</p>
<p>I will figure out the correct way to do this and post it back here.</p>
<p>Thanks for taking the time to help me.</p>
<p>&#8211;<br />
Regards<br />
Parag</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jessy</title>
		<link>http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/comment-page-1/#comment-724</link>
		<dc:creator>Jessy</dc:creator>
		<pubDate>Thu, 06 Aug 2009 02:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quaternio.net/?p=355#comment-724</guid>
		<description>Hi Parag, 

I assume from your terminology that you&#039;re working with Django. It looks like at the bottom of the django &lt;a href=&quot;http://docs.djangoproject.com/en/dev/topics/serialization/#notes-for-specific-serialization-formats&quot; rel=&quot;nofollow&quot;&gt;documentation on serialization&lt;/a&gt; it has some clues. i havent dont this myself, but if your custom encoder is called MyEncoder, i would try something like:

json_serializer = serializers.get_serializer(&quot;json&quot;)()
json_serializer.serialize(queryset, cls=MyEncoder, stream=response)

&#039;cls&#039; is the argument you use to pass the custm encoder to the json.dump() function as well (that was originally in my post, but i think that paragraph was eaten by the pre-formatter-- argh.  

Good luck!</description>
		<content:encoded><![CDATA[<p>Hi Parag, </p>
<p>I assume from your terminology that you&#8217;re working with Django. It looks like at the bottom of the django <a href="http://docs.djangoproject.com/en/dev/topics/serialization/#notes-for-specific-serialization-formats" rel="nofollow">documentation on serialization</a> it has some clues. i havent dont this myself, but if your custom encoder is called MyEncoder, i would try something like:</p>
<p>json_serializer = serializers.get_serializer(&#8221;json&#8221;)()<br />
json_serializer.serialize(queryset, cls=MyEncoder, stream=response)</p>
<p>&#8216;cls&#8217; is the argument you use to pass the custm encoder to the json.dump() function as well (that was originally in my post, but i think that paragraph was eaten by the pre-formatter&#8211; argh.  </p>
<p>Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Parag Shah</title>
		<link>http://blog.quaternio.net/2009/07/16/json-encoding-and-decoding-with-custom-objects-in-python/comment-page-1/#comment-712</link>
		<dc:creator>Parag Shah</dc:creator>
		<pubDate>Wed, 05 Aug 2009 11:43:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.quaternio.net/?p=355#comment-712</guid>
		<description>Thanks for the post. I found it while I was searching for JSON custom encoding.

However, I have a question. How do you tie MyEncoder in the serialization flow. So for example if my serialization code is such:

res = serializers.serialize(&quot;json&quot;, questions) 

Where questions is a QuerySet, and I want to use a custom encoder for encoding to be able to encode DateTime objects in a different way then the default JSONEncoder. How do I ensure that the above call uses the custom encoder instead of the default one.

--
Thanks
Parag</description>
		<content:encoded><![CDATA[<p>Thanks for the post. I found it while I was searching for JSON custom encoding.</p>
<p>However, I have a question. How do you tie MyEncoder in the serialization flow. So for example if my serialization code is such:</p>
<p>res = serializers.serialize(&#8221;json&#8221;, questions) </p>
<p>Where questions is a QuerySet, and I want to use a custom encoder for encoding to be able to encode DateTime objects in a different way then the default JSONEncoder. How do I ensure that the above call uses the custom encoder instead of the default one.</p>
<p>&#8211;<br />
Thanks<br />
Parag</p>
]]></content:encoded>
	</item>
</channel>
</rss>
