Created
November 18, 2021 14:11
-
-
Save gmbarroso/2bcee00eece97f90703aaaf22cde81f2 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 orderJSON = require('./order.json'); | |
let simulation = {} | |
let arrayOfItems = [] | |
const items = Object.values(orderJSON.content.items).map(value => { | |
let obj = { | |
"id": value.id, | |
"quantity": value.quantity, | |
"seller": "1" | |
} | |
return obj | |
}) | |
const getPostalCode = Object.values(orderJSON.content.shippingData)[0].postalCode | |
const getCountry = Object.values(orderJSON.content.shippingData)[0].country | |
simulation = { | |
"items": items, | |
"postalCode": getPostalCode, | |
"country": getCountry | |
} | |
console.log(JSON.stringify(simulation)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment