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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:39:39+00:00 2026-05-11T22:39:39+00:00

I am making an API for some AJAX related things in my web app

  • 0

I am making an API for some AJAX related things in my web app on GAE in Python. After setting the content-type to ‘application/json’ and accessing my url directly-

http://mysite.com/api?method=theMethod&param=firstParam

-I am being prompted with a ‘save file’ dialog box instead of seeing the JSON object displayed. The file contains the JSON object when opened in notepad.

Is this a correct way to return JSON from Python using GAE to be parsed in JavaScript?

from django.utils import simplejson
self.response.headers['Content-Type'] = 'application/json'
jsonData = {"foo" : "bar"}
self.response.out.write(simplejson.dumps(jsonData))

I have noticed that when using another API from somewhere else such as Flickr, my browser displays the JSON object rather than asking for me to save the file. This behavior is what encouraged me to investigate my implementation. My only thought is that this is related to a JSONP implementation.

Judging from rfc4627, I should be using ‘application/json’.

  • 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-11T22:39:39+00:00Added an answer on May 11, 2026 at 10:39 pm

    This is the right way, mime type for json is application/json not text/json and NEVER text/html.
    https://www.rfc-editor.org/rfc/rfc4627 starts with "The application/json Media Type for JavaScript Object Notation (JSON)"

    read this for more details/options

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

Sidebar

Related Questions

After making some changes in my models (eg. new field in a model and
After making a few modifications to a rails app I am tinkering on, railroad
I have been making a little toy web application in C# along the lines
Google announced the Analytics Data Export API some days ago, thereby making it much
Making echo of a question around the web: Is the syntax for svn:ignore patterns
Im making a small python script to upload files on the net. The script
I'm making a WinForms app with a ListView set to detail so that several
I'm developing a C api for some functionality written in C++ and I want
Can someone point me in the right direction in regards to making an api
I am making a distributed java app for which I need both parts of

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.