@Override
        public void accept(Object field) throws IOException {
            if (field == null) {
                generator().writeNull();
            } else if (field instanceof Boolean bool) {
                generator().writeBoolean(bool);
            } else if (field instanceof Number num) {
                renderNumberField(num);
            } else if (field instanceof TreeNode treenode) {
                generator().writeTree(treenode);
            } else if (field instanceof Tensor t) {
                renderTensor(Optional.of(t));
            } else if (field instanceof FeatureData featureData) {
                generator().writeRawValue(featureData.toJson(settings.tensorOptions));
            } else if (field instanceof Inspectable i) {
                renderInspectorDirect(i.inspect());
            } else if (field instanceof JsonProducer jp) {
                generator().writeRawValue(jp.toJson());
            } else if (field instanceof StringFieldValue sfv) {
                generator().writeString(sfv.getString());
            } else if (field instanceof TensorFieldValue tfv) {
                renderTensor(tfv.getTensor());
            } else if (field instanceof FieldValue fv) {
                // the null below is the field name which has already been written
                fv.serialize(null, new JsonWriter(generator));
            } else {
                generator().writeString(field.toString());
            }
        }
Call after all fields in a hit to close the "fields" field of the JSON object
container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java