2017-11-24 11 views
0

내가 이런 JSON 개체가 말해 존재하는 경우 :스트립 JSON 객체는 키

{ 
"results": [ 
    { 
    "failed": "no", 
    "data": "another string" 
    }, 
    "failed": "no", 
    "skipped": true 
    } 
} 

ansible 작전에 정의 된 "건너 뛰었습니다"한 모든 개체의 JSON을 제거하는 방법이 있나요?

{ results | rejectattr('skipped') | list } 
+0

키가있는 경우 또는 값이'true'입니까? – techraf

답변

1

사용 rejectattr 필터 것

스트립 "생략"한 모든 개체의 JSON을

정의
{{ results | rejectattr('skipped','defined') | list } 
1

가 문자 그대로의 요청에 응답 : 그래서 난 그냥

{ 
"results": [ 
    { 
    "failed": "no", 
    "data": "another string" 
    } 
}