Created 11-03-2022 06:52 AM
Hi all, I would like to change the name of objects and add values to the following JSON file.
[
{
"Ean": 4052269532309,
"Bestand": 0
},
{
"Ean": 4052269532316,
"Bestand": 0
},
{
"Ean": 4052269532323,
"Bestand": 0
}
]
The result of my specification is not what I expect.
JOLT Script:
[
{
"operation": "shift",
"spec": {
"*": {
"Ean": "gtin",
"ean": "gtin",
"EAN": "gtin",
"EanCode": "gtin",
"EAN-Code": "gtin",
"EANCode": "gtin",
"Ausdr1": "gtin",
"Bestand": "qty",
"Menge": "qty",
"Stock": "qty",
"stock": "qty",
"Verfügbare Menge (Kennzahl)": "qty",
"Verfügbare Menge": "qty"
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"update_date": "2022-11-03",
"supplier_name": "demo",
"file_name": "test"
}
}
]
I get this result:
{
"gtin" : [ 4052269532309, 4052269532316, 4052269532323 ],
"qty" : [ 0, 0, 0 ],
"update_date" : "2022-11-03",
"supplier_name" : "demo",
"file_name" : "test"
}
I expect that:
[
{
"gtin": 4052269532309,
"qty": 0,
"update_date" : "2022-11-03",
"supplier_name" : "demo",
"file_name" : "test"
},
{
"gtin": 4052269532316,
"qty": 0,
"update_date" : "2022-11-03",
"supplier_name" : "demo",
"file_name" : "test"
},
{
"gtin": 4052269532323,
",
"update_date" : "2022-11-03",
"supplier_name" : "demo",
"file_name" : "test"": 0,
"update_date" : "2022-11-03",
"supplier_name" : "demo",
"file_name" : "test"
}
]
Does anyone have an idea how I can customize it? Thanks for help
Created 11-03-2022 07:40 AM
Try that:
[
{
"operation": "shift",
"spec": {
"*": {
"Ean": "[&1].gtin",
"ean": "[&1].gtin",
"EAN": "[&1].gtin",
"EanCode": "[&1].gtin",
"EAN-Code": "[&1].gtin",
"EANCode": "[&1].gtin",
"Ausdr1": "[&1].gtin",
"Bestand": "[&1].qty",
"Menge": "[&1].qty",
"Stock": "[&1].qty",
"stock": "[&1].qty",
"Verfügbare Menge (Kennzahl)": "[&1].qty",
"Verfügbare Menge": "[&1].qty"
}
}
}, {
"operation": "modify-default-beta",
"spec": {
"*": {
"update_date": "2022-11-03",
"supplier_name": "demo",
"file_name": "test"
}
}
}
]
Greetings
Created 11-03-2022 07:40 AM
Try that:
[
{
"operation": "shift",
"spec": {
"*": {
"Ean": "[&1].gtin",
"ean": "[&1].gtin",
"EAN": "[&1].gtin",
"EanCode": "[&1].gtin",
"EAN-Code": "[&1].gtin",
"EANCode": "[&1].gtin",
"Ausdr1": "[&1].gtin",
"Bestand": "[&1].qty",
"Menge": "[&1].qty",
"Stock": "[&1].qty",
"stock": "[&1].qty",
"Verfügbare Menge (Kennzahl)": "[&1].qty",
"Verfügbare Menge": "[&1].qty"
}
}
}, {
"operation": "modify-default-beta",
"spec": {
"*": {
"update_date": "2022-11-03",
"supplier_name": "demo",
"file_name": "test"
}
}
}
]
Greetings