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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:25:46+00:00 2026-06-04T14:25:46+00:00

I’ve got an interesting problem with JSON and Django. I think I’ve narrowed it

  • 0

I’ve got an interesting problem with JSON and Django. I think I’ve narrowed it down to this problem. The problem is that I have a JSON object something like this:

{"embed": "<iframe width='640' height='360' src='http://www.youtube.com/embed/Sw5Gk1L4LQE?wmode=opaque' frameborder='0' allowfullscreen></iframe>"}

In PDB if I print out this as a simplejson.dumps I get this (notice the double quotes):

{"embed": "<iframe width=\\"640\\" height=\\"360\\" src=\\"http://www.youtube.com/embed/Sw5Gk1L4LQE?wmode=opaque\\" frameborder=\\"0\\" allowfullscreen></iframe>"}

The actual HttpResponse object has removed one slash from every set of double escapes like this.

return HttpResponse(simplejson.dumps(result), 'application/json'

{"embed": "<iframe width=\"640\" height=\"360\" src=\"http://www.youtube.com/embed/Sw5Gk1L4LQE?wmode=opaque\" frameborder=\"0\" allowfullscreen></iframe>"}

On the client I am using jQuery’s parseJSON and I am having problems with the one that has single escaped characters (3rd one) as it doesn’t see them as escaped. But it is actual valid JSON where as the 2nd one works when I try parseJSON on it directly in the console but it is not in fact valid JSON (according to JSONLint.com).

Any ideas of what I can do to get this JSON object from Django to the client and have the embed code intact? I’m hoping that is a small oversite on my part.

  • 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-04T14:25:47+00:00Added an answer on June 4, 2026 at 2:25 pm

    Ok so an hour later I finally realized I had made several small mistakes on this that made most everything break. I was loading the page locally instead of serving it through Django (just so I could test the jQuery Mobile stuff I was doing).

    In that local file I was copy/paste in the output from the JSON view in Django.

    I tried to use a JSONP call to that view and because of the jQuery JSONCallback it was throwing errors.

    In the end the correct way for testing this was to serve the HTML through Django so that I didn’t have to use JSONP and when I did that parseJSON accepted the JSON that had single escaped double quotes \” where as it supposedly won’t accept from copying and pasting in since that isn’t a response object.

    Hopefully my mistakes will help someone else out in the future.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string

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.