Adapter typeclass for building trees of type T that encode a subset of json, required for k8s objects