-2
[
  {
    "ID": 5,
    "Name": "pratik"
  },
  {
    "ID": 6,
    "Name": "pratiksha"
  },
  {
    "ID": 7,
    "Name": "pratikshaman"
  }
]

I want to display only : 6 Pratiksha

seenukarthi
  • 8,241
  • 10
  • 47
  • 68

1 Answers1

0

Not too clear on what your trying to achieve... is this what your wanting?

    //The json string
var jsonString = '[{"ID":5,"Name":"pratik"},{"ID":6,"Name":"pratiksha"},{"ID":7,"Name":"pratikshaman"}]',
    //The json array
    jsonArray = JSON.parse(jsonString),
    //search function to returns entry by id
    jsonSearch = function(id){
        return jsonArray.filter(function(obj){
            return obj.ID === id;
        });
    };
console.log(jsonSearch(6)); //Array contains your Pratiksha object and any other matches

http://jsfiddle.net/uckpL5bt/

Simon Staton
  • 4,345
  • 4
  • 27
  • 49