formatting nested keys correctly