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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:09:26+00:00 2026-06-15T03:09:26+00:00

I have a JSON-Object which includes following example entry: description:<div>- diversen Diskutanten- Moderiert vom

  • 0

I have a JSON-Object which includes following example entry:

description":"<div>- diversen Diskutanten- Moderiert vom gro\u00dfartigen PreibischDebatte, Gesprochenes, Kontroverses<div class="btn-group"><a class"btn" href=""><i class="icon-map-marker"><\/i><\/a><a class"btn" href=""><i class="icon-map-marker"><\/i><\/a><\/div><\/div>"

Now i am trying to add this html to another element in my code with:

$('#desc_text').empty();
$('#desc_text').html(event.description);
$('#description').modal('show');

The problem is that the html is not parsed as html, which I thought jquery .html() would do. I also tried with append(), but no change too.

Does anyone know how to parse this as html?

EDIT 2: The whole workflow, because it seems little confusing:

first I do:

$events = json_encode($func->getAllDates());

the function does:

public function getAllDates() {
        $this->db->query('SELECT * FROM dates ORDER BY start');
        $result = $this->db->mysql_fetch_all();
        for($i = 0; $i < count($result); $i++) {
            $result[$i]['description'] = html_entity_decode(utf8_encode($result[$i]['description']));
        }
print_r($result);
        return $result;
    }

Output of $result in function:

[6] => Array
        (
            [id] => 17
            [title] => Sabotage Debatte: Politik im Keller
            [start] => 2012-11-29 00:00:00
            [end] => 2012-11-29 00:00:00
            [allDay] => 1
            [url] => 
            [description] => <div>- diversen Diskutanten- Moderiert vom großartigen PreibischDebatte, Gesprochenes, Kontroverses<div class="btn-group"><a class"btn" href=""><i class="icon-map-marker"></i></a><a class"btn" href=""><i class="icon-map-marker"></i></a></div></div>
        )

EDIT:

As in comments said: The quoting seems the answer, but I don’t quote by myself and just use php-functions. Maybe the way I do is the wrong way.

I got something like this from my database:

&amp;lt;div&amp;gt;- diversen Diskutanten- Moderiert vom großartigen PreibischDebatte, Gesprochenes, Kontroverses&amp;lt;div class=&amp;quot;btn-group&amp;quot;&amp;gt;&amp;lt;a class&amp;quot;btn&amp;quot; href=&amp;quot;&amp;quot;&amp;gt;&amp;lt;i class=&amp;quot;icon-map-marker&amp;quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;a class&amp;quot;btn&amp;quot; href=&amp;quot;&amp;quot;&amp;gt;&amp;lt;i class=&amp;quot;icon-map-marker&amp;quot;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;

then I use

html_entity_decode(utf8_encode($result[$i]['description']));

to turn it back and then i use json_encode to put it in json-format. Shouldn’t do any of this functions a correct quoting?

I hope you get to the workflow…

  • 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-15T03:09:27+00:00Added an answer on June 15, 2026 at 3:09 am

    Your string has internal quotes which must be escaped. Additionally you have some faulty attributes like class"btn" which should be class="btn" After that, it will work fine.

    // description with all internal double quotes escaped by \"
    var event = {
        "description":"<div>- diversen Diskutanten- Moderiert vom gro\u00dfartigen PreibischDebatte, Gesprochenes, Kontroverses<div class=\"btn-group\"><a class=\"btn\" href=\"\"><i class=\"icon-map-marker\"><\/i><\/a><a class=\"btn\" href=\"\"><i class=\"icon-map-marker\"><\/i><\/a><\/div><\/div>"
        };
    $('#desc_text').empty();
    $('#desc_text').html(event.description);​
    

    Here is an example on jsfiddle

    Update after OP comments:

    Since you are retrieving this value and decoding the entities (which include the quotes), you must json_encode() it to produce properly escaped quotes.

    json_encode(html_entity_decode(utf8_encode($result[$i]['description'])));
    

    Or more likely, encode the entire array that this comes from:

    json_encode($your_database_row_array);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON object which is generated by PHP. It's an object with
I have created an empty json object having an array itemlist(which further contains itemid
I have a form field which requires a json object as its value when
I have a working JavaScript code below which dynamically creates JSON object using JSON.parse
I have several TextField columns on my UserProfile object which contain JSON objects. I've
I have a object which I want to serialize to JSON. This object is
I have an array which includes URLs of JSON feeds. I am using ASIHTTPRequest
I have json object like this, the site is running codeigniter which is ultimately
I have a simple json string which contains a collection of objects http://sandapps.com/InAppAds/ads.json.txt When
i have this JSON object: {error:null, result:[{id:1234567890, count:1, recipients: [u3848, u8958, u7477474 ], dateCreated:2012-06-13T09:13:45.989Z

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.