Click here to Skip to main content
15,921,467 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code:
C#
var jsonData = JSON.stringify(data);
                    alert(jsonData);

its return a string:
[{"studentId":1,"name":"XYZ"}]
but when iam passing jsonData to objData:
C#
var objData = $.parseJSON(jsonData);
                    alert(objData);

iam getting :[object Object]
but i want a string:
C#
var id = objData.studentId;
               var fname = objData.name; 

Can anyone please let me know what I am missing here
Posted

1 solution

Try out:
C#
alert(objData[0].studentId);
alert(objData[0].name);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900