code: void buildEntityJson(ObjectNode parent) {
      for (Element child : this.children) {
        ObjectNode node = child.asEntityJson(parent);
  
        if (node != null) {
          child.buildEntityJson(node);
        } else {
          child.buildEntityJson(parent);
        }
      }
    }
docs: Traverse the element and its children to construct its representation as EntityJSON nodes.