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

  • Home
  • SEARCH
  • 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 8722075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:19:44+00:00 2026-06-13T07:19:44+00:00

I am trying to make an API call to http://api.stackoverflow.com/1.1/badges/name My code snippet –

  • 0

I am trying to make an API call to http://api.stackoverflow.com/1.1/badges/name

My code snippet –

url = 'http://api.stackoverflow.com/1.1/badges/name'
f = urllib2.urlopen(url)
content = f.read()
jsonobj = json.loads(content)
print jsonobj

This gives me the error –
ValueError: No JSON object could be decoded

When I tried http://jsonviewer.stack.hu to load the json object from the above URL, it showed me garbled characters. You can see the output here – http://jsonviewer.stack.hu/#http://api.stackoverflow.com/1.1/badges/name

The text is displayed normally in the browser window if you go to http://api.stackoverflow.com/1.1/badges/name

I tried adding UTF-8 encoding –

jsonobj = json.loads(content, encoding = 'UTF-8')

but it still gives the same error.

  • 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-13T07:19:45+00:00Added an answer on June 13, 2026 at 7:19 am

    According to http://api.stackoverflow.com/1.0/usage the returned information is gzipped. You will have to unzip the binary data to get the actual JSON. You can do this with the gzip and StringIO modules:

    url = urllib2.urlopen('http://api.stackoverflow.com/1.1/badges/name')
    zippedContents = url.read()
    sio = StringIO.StringIO(zippedContents)
    gz = gzip.GzipFile(fileobj=sio)
    print gz.read()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a API call to wikipedia through: http://en.wikipedia.org/w/api.php?action=parse&page=Petunia&format=xml , but
I am trying to make a call to api which returns json object {
I'm trying to make a RESTful API with rails. When I try http://localhost:3000/api/v1/projects.json?token=kS8xi7YzaUDEmbmi9XL6 I
I'm trying to make this request to the RunKeeper API : GET /user HTTP/1.1
I'm trying to make a RESTful api call from the android emulator (using android
I am using this sample app to make route http://blog.kadirpekel.com/2010/05/30/drawing_routes_onto_mkmapview_using_unofficial_google_maps_directions_api/ It will call the
I'm trying to use a service to make a regular call to my API.
I'm trying to make a simple AJAX call to the Justin TV API, which
I am trying to make a POST request to /api/kpi?data=some+stuff : curl -i http://127.0.0.1:9010/api/create_kpi
I'm trying to make an API for my rails application using JSON responses to

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.