[Solved] Unable to retrieve data from object [closed]
Loop employeeJSON instead of employeeJSON.Fakir $(document).ready(function() { var jsonString = ‘{“Fakir”:{“firstName”:”Bharat”,”lastName”:”Tiwari”,”gender”:”Male”,”salary”:50000},”Pagal”:{“firstName”:”Nanu”,”lastName”:”Pagal”,”gender”:”Male”,”salary”:90000}}’; var employeeJSON = JSON.parse(jsonString); var result=””; $.each(employeeJSON,function(i,item){ result += item[‘firstName’] + “<br>”; result += item.lastName + “<br>”; result += item.gender + “<br>”; result += item.salary + “<br> <br>”; }); $(“#divResult”).html(result) }) <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <div id=”divResult”> </div> 2 solved Unable to retrieve data from object … Read more