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 8604907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:41:34+00:00 2026-06-12T02:41:34+00:00

I feel like I’m missing something terribly obvious, but I can’t see it. In

  • 0

I feel like I’m missing something terribly obvious, but I can’t see it.

In ipython (Python 2.7), this works:

In [1]: json.loads('[]')
Out[1]: []

I’m trying to do the equivalent minimal example in a Django view, to convince myself I can read JSON before moving on to a real data structure:

def submit(request):
    json_string = request.GET['json']
    parsed = json.loads(json_string)

    return HttpResponse(parsed)

I call it from my browser by going to

http://localhost:8001/submit/?json='[]'

And I get ValueError: No JSON object could be decoded.

What am I doing wrong, and how do I debug it? Is this some kind of encoding problem? Or am I accessing the content of the GET incorrectly? Or something else?

I’ve tried dumping the variable json_string, both to a file and as an HttpResponse. Both times I get '[]', which sure looks fine…

Edit:

For the benefit of any other beginners wondering how to debug a POST, Django’s error page is returned in the exception. A quick and nasty hack that works is

import os
def debug_post(post_req):

    result = None
    try:
        result = submit_to_endpoint(post_req)
    except urllib2.URLError as e:
        out_fh = open('debug_post.tmp', 'w')
        out_fh.write(e.read())
        out_fh.close()
        os.system('firefox ' + 'debug.tmp')

    return result
  • 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-06-12T02:41:35+00:00Added an answer on June 12, 2026 at 2:41 am

    You’ve included the single quotes in the JSON string. There’s no need for that, especially as single quotes are not valid in JSON. You should go to http://localhost:8001/submit/?json=[].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like I'm missing something obvious, but I can't work out why my
I feel like I'm missing something very obvious here, but I can't get a
I feel like I am missing something very simple here, but this is the
I feel like there's something about grids that I'm missing, but I can't find
I feel like this is a dumb question and I'm missing something, but I
I feel like I've only ever seen this here on SO, but I can't
I feel like this is something I should already know, but I'm just not
I feel like this must be very easy, but I can't find the answer
I feel like I've read a question similar to this but I can't find
I feel like there is an obvious answer to this, but it's been eluding

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.