groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Metcalf <bwmetc...@gmail.com>
Subject finding value of key at same level as another key
Date Tue, 27 Nov 2018 17:20:17 GMT
Hello,

I have the following json

{
  "status": {
    "group": "group1",
    "partitions": [
      {
        "topic": "topic1",
        "partition": 0,
        "start": {
          "offset": 0,
          "timestamp": 1543337772415,
          "lag": 0,
          "max_offset": 0
        },
        "end": {
          "offset": 0,
          "timestamp": 1543337812000,
          "lag": 0,
          "max_offset": 0
        }
      }
    ]
  }
}

I'm looking for a way in groovy to find the value of
status.partitions.end.lag when I know the values of status.group,
status.partitions.topic and status.partitions.partition?  I may need to
rethink my approach to how I think I should parse this json, but hopefully
there is an easy way to do this.

Also, there can be multiple levels of the values that I know.  Just showing
one for simplicity.

Thanks.

Mime
View raw message