Is there a way to use circe-optics' JsonPath with strings, just as in jq CLI tool?

809 Views Asked by At

What I'd like to do, is having field descriptor defined as field1.field2[1].field3, access value two of json:

{
  "field1": {
    "field2": [
      {
        "field3": "one"
      },
      {
        "field3": "two"
      }
    ]
  }
}

I know I can do that using applyDynamic and root.field1.field2.index(1).field3, but is there a way to create such a lens using a string?

0

There are 0 best solutions below