简体   繁体   中英

simplejson decoder for a python script

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

{ "name":"some",
  "products_valid_time_from":2011-08-01T14: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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM