2016-02-26 1 views
0

Je voudrais transformer ensemble de la recherche sharepoint API reste des objets comme celui-ci:Sharepoint gamme recherche API transformée au format standard

Object 
Key:"Path" 
Value:"https://host.com/file.pdf" 
ValueType:"Edm.String" 

Pour format standard comme:

Object 
Path: "https://host.com/file.pdf" 

Quel est le meilleur façon? Je cherchais une solution dans la documentation de lodash mais je n'ai rien trouvé. Merci.

Répondre

0

Veuillez jeter un coup d'œil.

var reformattedArray = function(obj){ 
    var rObj = {}; 
    for(var i=0;props > i;i++){ 
     rObj[obj[i].Key] = obj[i].Value; 
    } 
    return rObj; 
}; 
console.log(reformattedArray(<array to be transformed>)); 

Maintenant, mon tableau est transformé au format requis.