Ritesh Shukla
Ritesh Shukla

Reputation: 1

How can I get the value of `hostnames` key using JMESPath?

I have the following json and want to retrieve the value of \"hostnames\", under "freeform-tags"."ADB$MIGRATION1":

[
  {
    "freeform-tags": {
      "ADB$MIGRATION1": "{\"hostnames\":[\"Test-company1\",\"Test-company2\"],\"port\":1521,}",
      "databasetype": "QA"
    }
]

I tried the following:

[]."freeform-tags"."ADB$MIGRATION1"|[0].'\"hostnames\"'
[]."freeform-tags"."ADB$MIGRATION1"|[0].\"hostnames\"

Tried using search:

search("\"hostnames\"", []."freeform-tags"."ADB$MIGRATION1")

I think am doing something pretty basic wrong, but don't know where.

Upvotes: 0

Views: 23

Answers (0)

Related Questions