I forgot to mention that I am trying to deserialize the data as
follows:

"
...
gantt_data = request.POST.get('ganttdata')

for obj in serializers.deserialize("json", gantt_data):
    <loop logic here>
...
"

On Sep 2, 10:37 am, Eric <elezo...@gmail.com> wrote:
> Hi,
> I am attempting to parse a json string passed to my view via a form
> post.   A simple example of my json structure is as follows (indented
> for readability):
>
> {
>     "ganttgroups":[
>         {
>             "gantts":[
>                 {
>                     "rows":[
>                         {"stt":1, "end":2, "ttl":"test row - gr1 ga1
> ta1",  "own":"Tim Johnson"},
>                         {"stt":2, "end":3, "ttl":"my row (g1 t2)",
> "own":"John Doe"},
>                         {"stt":1, "end":2, "ttl":"test row - gr1 ga1
> ta3", "own":"Mary Smith"}
>                     ]
>                 },
>                 {
>                     "rows":[
>                         {"stt":1, "end":2, "ttl":"My 4th task",
> "own":"Eric Johnson"},
>                         {"stt":1, "end":2, "ttl":"my row (g2 t2)",
> "own":"Jeff Smith"},
>                         {"stt":1, "end":2, "ttl":"test row - gr1 ga2
> t3", "own":"Bill Baker"}
>                     ]
>                 }
>             ],
>             "start":"2009-1-01"
>         }
>         ,{
>             "gantts":[
>                 {
>                     "rows":[
>                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t1",
> "own":"Ted Tillman"},
>                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t2",
> "own":"Kim Crane"},
>                         {"stt":1, "end":2, "ttl":"row - gr2 ga1 t3",
> "own":"Bob Barker"}
>                     ]
>                 }
>             ],
>             "start":"2009-1-01"
>         }
>     ]
>
> }
>
> I would like to parse it so that I can loop over the pairs/arrays to
> access the data. When I try to deserialize the data, I get the django
> error "string indices must be integers". Can anybody please help me
> determine what exactly this means and how I may fix this?  Is there
> another method I should be using? I am obviously a bit of a newbie at
> this so any help would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to