Updated add_field function. It is now possible to give a structure as input.
For instance, if there is a json object that contains attr1.attr2.attr3, then we can call this function with that json object, the value and "attr1.attr4". This will create a new attribute on the same level as attr3 with the specified value.