Hi Wei,
First, you have to retrive the Array from your JSONModel using following method.
var oArray = this.getView().getModel("modelName").getProperty("/rootStringValue");
Then you have to loop through both array and JS object. In your case, the dataUser is already an Array.
var i, name, obj, targetIndex;
for (i=0; i < dataUser.length; i++) {
obj = dataUser[i];
for (name in obj) {
if ( name == "user_name" && obj.name == "user_2")
targetIndex = i;
}
}
via this targetIndex, you can locate the right array element contains the information and you can retrieve what you want.
var targetObj = dataUser[targetIndex];
var id = targetIndex.user_id;
I think this id is namely what you I want. My code is not optimized, but I think the logic is right. You can give it a try.
Regards,
La