How to get json key and value in javascript?

前端 未结 8 1386
暗喜
暗喜 2020-11-28 06:02

I am returning a json as shown below

{\"name\": \"\", \"skills\": \"\", \"jobtitel\": \"Entwickler\", \"res_linkedin\": \"GwebSearch\"}

I a

8条回答
  •  误落风尘
    2020-11-28 06:25

    //By using jquery json parser    
    var obj = $.parseJSON('{"name": "", "skills": "", "jobtitel": "Entwickler", "res_linkedin": "GwebSearch"}');
    alert(obj['jobtitel']);
    
    //By using javasript json parser
    var t = JSON.parse('{"name": "", "skills": "", "jobtitel": "Entwickler", "res_linkedin": "GwebSearch"}');
    alert(t['jobtitel'])
    

    Check this jsfiddle

    As of jQuery 3.0, $.parseJSON is deprecated. To parse JSON strings use the native JSON.parse method instead.

    Source: http://api.jquery.com/jquery.parsejson/

提交回复
热议问题