atc
atc

Reputation: 621

Parsing Json using jquery - not getting value

I am getting following values from server

{"status":{"message":"success","code":200},"data":[{"sent":"test","category":"Appo","experience_time":"2014-10-07","sent_id":4501922,"categoryId":4011,"score":"Negative","feature":"emp","op":"challenges"}]}

I need to get the value of sent,category,experience_time,sent_id,score,feature,op etc

I have tried following so far.But not getting any value.

 var result = jQuery.parseJSON(data);

          $.each(result, function(index, value) {

alert(value.score);

        });

Upvotes: 0

Views: 55

Answers (1)

Mox Shah
Mox Shah

Reputation: 3015

try this,

var jsonString = '{"status":{"message":"success","code":200},"data":[{"sent":"test","category":"Appo","experience_time":"2014-10-07","sent_id":4501922,"categoryId":4011,"score":"Negative","feature":"emp","op":"challenges"}]}';


var result = jQuery.parseJSON(jsonString);

$.each(result.data, function(index, value) {

  alert(value.score);

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Upvotes: 1

Related Questions