473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Python 2.6 json & encoding of datetime.

Hi there,

I've been playing with Python's new json library, and found myself
facing a seemingly simple problem: encoding of datetime objects. Some
'jsonlib' that I was using previously was unable to do this, and the
new built-in json module shares the same limitation.

A bit of googling around brought me to <http://www.west-wind.com/
WebLog/posts/214731.aspxwhich seems to suggest there is no
standardised way of doing it. Indeed, reading the rather sparse JSON
RFC makes no mention of it.

It appears my only possibility is writing little helper functions to
convert my datetimes to/from ISO8601 strings or UNIX timestamps, but
this just feels wrong. Suggestions?

Thanks,
David.
Oct 11 '08 #1
0 2212

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Cole | last post by:
I'm new to JSON but see how it can be an improvement over XML for some things. I've modified a test servlet to return the following string with a content type of text/x-json: { header: {...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 416 open ( +3) / 3408 closed ( +1) / 3824 total ( +4) Bugs : 898 open ( +1) / 6180 closed (+13) / 7078 total (+14) RFE : 234 open...
3
by: astarocean | last post by:
i'm using maildrophost to sendmail and wrote a script for it when the script is called directly from web request , a letter geneated with right things but when the script is called from...
5
by: Otto Wyss | last post by:
I've now been looking for a week for a simple but useful sample on how to get a list of entries (persons) via an XMLHttpRequest using Json/PHP on the server. So far I've found about a thousend...
1
by: seth | last post by:
Hi: I'm trying to read JSON strings sent from the browser. Here is the scenario: 1. Using YUI tookit 2. sending JSON string from YUI toolkit - using the provided asyncRequest method. **I...
3
by: bsagert | last post by:
Some web feeds use decimal character entities that seem to confuse Python (or me). For example, the string "doesn't" may be coded as "doesn’t" which should produce a right leaning apostrophe....
6
by: Lasse Reichstein Nielsen | last post by:
Max <adsl@tiscali.itwrites: Not really. It shows that a particularly naïve implementation of a conversion from XML to JSON doesn't work well. What if the conversion of <e> some
1
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I have a asp.net app, in client I create a Complicate json string, for example: { a: ‘a’, b : { b ; ‘b’ } } If .net has corresponding type, it could be deserialized, for example: ...
0
by: crocodilu2008 | last post by:
JSON vs. XML JSON and XML are basically used for the same purpose—to represent and interchange data. I'll try to show you why you might want to use JSON rather than XML in an AJAX context by showing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.