denormalizing JSON with jq

前端 未结 1 562
萌比男神i
萌比男神i 2021-01-21 11:10

I have JSON that looks like this:

    [
      {
        \"fields\": {
          \"versions\": [
            {
              \"id\": \"36143\",
              \"na         


        
1条回答
  •  渐次进展
    2021-01-21 11:40

    This should work. You wouldn't want to use a group_by here, you would do that if you were trying to go from more to less, we're going the other way.

    You're combining the different versions with the corresponding severity. Here's how you could do that.

    map(.fields | (.versions[] | { id, name }) + { value: .severity.value })
    

    0 讨论(0)
提交回复
热议问题