Circe-Optics how to specify a path with dash

133 views Asked by At

I am trying to access a field in json with circe-optics. Issue is the field contains a dash:

root.TAB-NR.string

While if i write

root.TAB_NR.string it works, but the field does not exist.

Any idea how i can handle this case ?

1

There are 1 answers

0
Thilo On BEST ANSWER

If you need to use special characters in Scala identifiers that would otherwise be illegal, you can use backticks to quote them.

val `my funky value` = root.`TAB-NR`.string