JQuery JSON parsing not performed for data attribute with double quotes

I experience that the encoded HTML values ​​are incorrectly selected where jQuery reads the attribute value - quotes are decoded - so JSON parsing is not performed on that value.

Is this a bug in jQuery or am I not coding my values ​​correctly?

Here is my HTML encoded JSON string:

[
    {
        "id": "1",
        "organisation_id": "1",
        "badge_id": "49",
        "target": "15",
        "target_type": "actions",
        "target_title": null,
        "target_description": null,
        "start": "2014-01-15",
        "name": "Our goal",
        "description": "Vestibulum id ligula porta felis euismod semper. "Nullam" id dolor id nibh ultricies vehicula ut id elit. Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.",
        "created": "2013-08-07 14:26:56"
    },
    {
        "id": "19",
        "organisation_id": "1",
        "badge_id": "49",
        "target": "30000000",
        "target_type": "numeric",
        "target_title": "Revenue contribution",
        "target_description": "Specify how much this action contributes to the revenue goal",
        "start": "2014-01-21",
        "name": "November revenue",
        "description": "Reach revenue of $30,000,000 in November. Let's do this.",
        "created": "2014-01-21 16:59:25"
    }
]

Pay attention to "the property description.

And here the problem is reproduced: http://jsfiddle.net/J8Xv6/

I think this is a problem that appears in new versions of jQuery. Just updated from 1.7.x to 1.11.0.

+3
source share
2 answers

JSON. , JavaScript, HTML . .

HTML- HTML- , , JSON ( ).

HTML, JSON.

edit — jsfiddle, data jQuery .data(). , , jQuery , JSON, . , , .

+2

,

"[{"id":"1","organisation_id":"1","badge_id":"49","target":"15","target_type":"actions","target_title":null,"target_description":null,"start":"2014-01-15","name":"Our goal","description":"Vestibulum id ligula porta felis euismod semper. "Nullam" id dolor id nibh ultricies vehicula ut id elit. Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.","created":"2013-08-07 14:26:56"},{"id":"19","organisation_id":"1","badge_id":"49","target":"30000000","target_type":"numeric","target_title":"Revenue contribution","target_description":"Specify how much this action contributes to the revenue goal","start":"2014-01-21","name":"November revenue","description":"Reach revenue of $30,000,000 in November. Let do this.","created":"2014-01-21 16:59:25"}]"

, .

" Vestibulum id ligula porta felis euismod semper. "Nullam" id dolor id nibh ultricies vehicleula ut id elit. Nulla vitae elit libero, a phuera augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent como cursus magna, vel scelerisque nisl consectetur et. "

0

All Articles