颠簸转型
Jolt Transformation
我正在尝试为以下输入编写颠簸转换 -
{
"restaurantId": "ZZ4ORJDY3E",
"chainId": "a-b"
}
预期输出是 -
{
"ZZ4ORJDY3E" : {
"key" : "ZZ4ORJDY3E",
"start" : "a",
"end" : "b"
}
}
我的规格是 -
[
{
"operation": "shift",
"spec": {
"@restaurantId": "@restaurantId.key",
"chainId": {
"*-*": {
"$(0,1)": "@restaurantId.start",
"$(0,2)": "@restaurantId.end"
}
}
}
}
]
规范未按预期输出进行转换。我想学习如何在字符串解析器中使用属性。
规格
[
{
"operation": "shift",
"spec": {
"restaurantId": {
// match any value of restaurantId
"*": {
// write the value to of the key $ to the output
// where the output is the "value of the key".key
// kinda hokey
"$": "&.key"
}
},
"chainId": {
"*-*": {
// write each part of the chainId to the output
// at the value of restaurantId from back up the tree
"$(0,1)": "@(3,restaurantId).start",
"$(0,2)": "@(3,restaurantId).end"
}
}
}
}
]
我正在尝试为以下输入编写颠簸转换 -
{
"restaurantId": "ZZ4ORJDY3E",
"chainId": "a-b"
}
预期输出是 -
{
"ZZ4ORJDY3E" : {
"key" : "ZZ4ORJDY3E",
"start" : "a",
"end" : "b"
}
}
我的规格是 -
[
{
"operation": "shift",
"spec": {
"@restaurantId": "@restaurantId.key",
"chainId": {
"*-*": {
"$(0,1)": "@restaurantId.start",
"$(0,2)": "@restaurantId.end"
}
}
}
}
]
规范未按预期输出进行转换。我想学习如何在字符串解析器中使用属性。
规格
[
{
"operation": "shift",
"spec": {
"restaurantId": {
// match any value of restaurantId
"*": {
// write the value to of the key $ to the output
// where the output is the "value of the key".key
// kinda hokey
"$": "&.key"
}
},
"chainId": {
"*-*": {
// write each part of the chainId to the output
// at the value of restaurantId from back up the tree
"$(0,1)": "@(3,restaurantId).start",
"$(0,2)": "@(3,restaurantId).end"
}
}
}
}
]