0

An API return object like this

[attr] => stdClass Object
   (
       [id] => 555
       [ttl] => 360
       [aa-type] => NS
       [prio] => 9
   )

In my twig template, in FOR, how i can get aa-type ?

{{ value.attr.id }} -> ok
{{ value.attr.aa-type }} -> Nok because "-"

1 Answers1

3

To access attributes on an object with special characters you can use the attribute function

{{ attribute(value.attr, 'aa-type') }}

Chris Haas
  • 53,986
  • 12
  • 141
  • 274