jquery json parsing

后端 未结 2 1034
梦谈多话
梦谈多话 2020-12-16 04:14

How do I parse this json with jQuery?

DayEvents: [{
      \"0\": \"886\",
      \"event_id\": \"886\",
      \"1\": \"5029\",
      \"user_id\": \"5029\",
           


        
2条回答
  •  盖世英雄少女心
    2020-12-16 04:19

    Stolen from .parseJSON() doc.

    Example:

    Parse a JSON string.

    var obj = jQuery.parseJSON('{"name":"John"}');
    alert( obj.name === "John" );
    

    Your example code seems to be an object already. You would have the put braces around the whole thing to use and parse it with parseJSON.

提交回复
热议问题