开发者

simplejson decoder for a python script

开发者 https://www.devze.com 2023-03-25 15:40 出处:网络
I am trying to parse the code with simplejson using a python script. { \"name\":\"some\", \"products_valid_time_from\":2011-08-01开发者_开发问答T14:45:00,

I am trying to parse the code with simplejson using a python script.

{ "name":"some",
  "products_valid_time_from":2011-08-01开发者_开发问答T14:45:00,
  "products_valid_time_to":2011-08-01T21:00:00,
  }

Ia m getting an error

simplejson.decoder.JSONDecodeError: Expecting , delimiter: line 2 column 34 (char 52)

Can some one help me with this?


Dates are not part of JSON. See for example this blog entry.


Your dates need to be in quotes. It's just another string to the JSON parser.


The format is wrong.

You can follow this json rule

You can save your date as string first. Then when you retrieve that value, you can use alternative library to convert string into date.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号