shipping custom attribute: wrong input name

I am working on a module to add two custom attributes to the shipping address during checkout. The fields are there but the name of the input is not right. It’s this type:

name="my_attribute"  

instead of

name="custom_attributes[my_attribute]" 

In other words, the attribute is not correctly placed inside the javascript object. Any ideas?