kangarooDataCenterV3/jolt-demo/shift/spec7.json

28 lines
1.2 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"operation": "shift",
"spec": {
"ratings": {
"*": {
"$": "Ratings[#2].Name",//"Ratings[#2].Name": 将当前键(例如 "primary") 作为值输出到 Ratings[#2].Name。其中 $ 表示键的名称
"@": "Ratings[#2].Value"//"Ratings[#2].Value": 将当前值(例如 5) 作为值输出到 Ratings[#2].Value。其中 @ 表示值。
}
}
}
}
]
//#2实际表示向上回溯两级索引从 0 开始
//#number 用于引用树中的层级索引
//#2的核心作用回溯路径层级完成动态索引填充
//当前路径root(0) → ratings(1) → *(2) → 当前操作(3)
//#2表示从第3级向上回溯2级即回到第1级ratings层级
//回溯后Jolt会获取该层级如ratings下匹配项的运行时索引值从0开始自动生成
//例如输入JSON的ratings有3个子键primary索引0、quality索引1、design索引2
//处理primary时#2回溯到ratings并获取索引0处理design时获取索引2
//在LHS RHS都可以使用但是意义不同
//在RHS, #号只在数组中有效 比如[#2]
//在LSH中#允许您指定硬编码字符串作为输出中的值
//LSH#