2016-03-23 12 views
-1

マイ入力JSONJOLT - 順列変換

{ 
    "title": [ 
     "vsnu", 
     "anothervsnu" 
    ] 
} 

MY SPEC

[ 
    { 
    "operation": "shift", 
    "spec": { 
     "title": { 
     "*": { 
      "$(1)": "Responses[].head", 
      "@": "Responses[].name" 
     } 
     } 
    } 
    } 
] 

マイ出力:

{ 
    "Responses" : [ { 
    "head" : "title" 
    }, { 
    "name" : "vsnu" 
    }, { 
    "head" : "title" 
    }, { 
    "name" : "anothervsnu" 
    } ] 
} 

予想される出力:

{ 
    "Responses" : [ { 
    "head" : "title", 
    "name" : "vsnu" 
    }, { 
    "head" : "title", 
    "name" : "anothervsnu" 
    } ] 
} 

上記の期待される出力に対して、正しいJOLT仕様を書いてください。 反復処理中に「タイトル」を設定できません。

答えて

1

これは機能します。

[ 
    { 
    "operation": "shift", 
    "spec": { 
     "title": { 
     "*": { 
      "$(1)": "Responses.[#2].head", 
      "@": "Responses.[#2].name" 
     } 
     } 
    } 
    } 
]