'Jolt Transform results null in the Output-File
I have following Input-File, which I want to convert into the Output-File below. But the Output-file results null.
Input:
{
"edinachraz_such": "ABAS_TO_OPERATIONS1",
"id": "(462793,53,0)",
"fcode": 0,
"status": 2,
"table": [
{
"zn": 1,
"text3": "Kommentar",
"text4": "20.01.2021",
"text1": "Maintenance of machine BCX 7712",
"text2": "Check oil pressure , oil leck",
"text7": "abc",
"text5": "23.01.2021",
"text6": "[2133]"
}
]
}
Jolt Spec:
[
{
"operation": "shift",
"spec": {
"table": {
"text1": "name",
"text2": "description",
"text3": "comments",
"text4": "startDate",
"text5": "dueDate",
"text6": "documentBaseIds",
"text7": "classification"
}
}
}
]
Expected Output:
{
"name ": "Maintenance of machine BCX 7712",
"description": "Check oil pressure , oil level",
"comments ": "User comments",
"startDate ": "utc",
"dueDate ": "tuc",
"documentBaseIds " : [2133],
"classification " : tbd
}
Solution 1:[1]
Just need to add "*": { following "table": { to represent indexes of the table array, in order to be able to walk through the elements of it such as
[
{
"operation": "shift",
"spec": {
"table": {
"*": {
"text1": "name",
"text2": "description",
"text3": "comments",
"text4": "startDate",
"text5": "dueDate",
"text6": "documentBaseIds",
"text7": "classification"
}
}
}
}
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Barbaros Özhan |

