convert a flat object with namespaced keys to a heirarchical object