Given following JSON object
var data = {
    "ok" : true,
    "messages" : [
        {
            "type" : "message",
            "subtype" : "bot_remove"
        },
        {
            "type":"message",
            "subtype":"file_share",
            "file" : {
                "name" : "file_name"
            },
        }    
    ],
    "has_more" : false
}
using jQuery I'de like to create a new JSON object that contains only the object with the value "file_share". Im just not sure if I should be using $.grep or javascript's delete
something like
var newObject = [];
var result = $.grep(data.messages , function(key,value){
    return +key.subtype !== "file_share";
    newObject.push(result)
}); 
or using $.grep to filter the object whose length more than 0 (as the second object contains a child object).
Would I then have to stringify and / or $.parseJSON() the newObject?
 
     
     
     
    