0

I have a json text as below

{
  "_links": {
    "self": {
      "href": "http://xxx:8080/info"
    }
  },
  "build": {
    "name": "xxxx",
    "version": "2.0.23-69",
    "description": "xxxx"
  }
}

iam trying to get the version from the above json by using the below command

cat info.txt|jq  .version

but this is returning null. how can i get the version as 2.0.23-69

1 Answer 1

1

.version is inside .build, so the direct approach would be to write: .build | .version, or .build.version for short.

If in general you don't know exactly where the object of interest lives, you can also use the .. filter, e.g. .. | objects | .version // empty.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.