Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6057983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:32:54+00:00 2026-05-23T08:32:54+00:00

This one has had me pulling out my hair. I’ve been trying to deserialize

  • 0

This one has had me pulling out my hair. I’ve been trying to deserialize JSON in Django for the last couple hours.

I have a function:

    # in index.html
    function updateWidgetData(){  
        var items=[]; 
        for statement here:
            for statement here:
                var item={  
                    id: $j(this).attr('id'),  
                    collapsed: collapsed,  
                    order : i,  
                    column: columnId  
                };  
        items.push(item);  

        var sortorder={ items: items};  

        $j.post('2', 'data='+$j.toJSON(sortorder), function(response)
        {  
            if(response=="success")  
                $j("#console").html('<div class="success">Saved</div>').hide().fadeIn(1000);  
            setTimeout(function(){  
                $j('#console').fadeOut(1000);  
        }, 2000);  
    });

}

And I’m trying to deserialize the JSON in django:

# in views.py
if request.is_ajax():
    for item in serializers.deserialize("json", request.content):
        item = MyObject(id=id, collapsed=collapsed, order=order, column=column)
    return HttpResponse("success")
else:
    ....

And it hasn’t been working. I know this is probably a really trivial question, but I’ve never used JSON before, and I’d really appreciate some help. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:32:55+00:00Added an answer on May 23, 2026 at 8:32 am

    serializers.deserialize is for deserializing a particular type of JSON – that is, data that was serialized from model instances using serializers.serialize. For your data, you just want the standard simplejson module.

    And the second thing wrong is that your response isn’t just JSON – it is an HTTP POST with JSON in the data field. So:

    from django.utils import simplejson
    data = simplejson.loads(request.POST['data'])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one has made me a lot of stress over the last couple of
This problem of mine has me pulling my hair out. It's related to the
This one has been perplexing me on a couple recent sites I've worked on,
This one has been stumping me for a while. But I'm no expert. This
It turns out that in order to do this one has to bind the
I've been working on some MySQL Joins but this one has got me a
This one has been driving me nuts for a few days now and I've
If I had a string like this one that has punctuation like ,, ?,
May be some one has had similar experiences on this dilemma and can help
I'm pulling my hair out... Trying to get Drupal Boost to work on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.