Created
September 8, 2017 20:12
-
-
Save BransonGitomeh/c8fa9997efd8f271cd9a7bb0574eedcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = { Item:[ { Name: 'Amount', Value: 5 },{ Name: 'MpesaReceiptNumber', Value: 'LI85581A6Z' },{ Name: 'Balance' }, {Name: 'TransactionDate', Value: '20170908181744' }, { Name: 'PhoneNumber', Value: '254723587767' } ] } | |
const corrected = {} | |
test.Item.map(node=>corrected[node.Name] = node.Value) | |
console.log(corrected) | |
// { Amount: 5, | |
// MpesaReceiptNumber: 'LI85581A6Z', | |
// Balance: undefined, | |
// TransactionDate: '20170908181744', | |
// PhoneNumber: '254723587767' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment