private Inspector maybeConvertMap(Inspector data) {
            var map = new Value.ObjectValue();
            for (int i = 0; i < data.entryCount(); i++) {
                Inspector obj = data.entry(i);
                if (obj.type() != Type.OBJECT || obj.fieldCount() != 2) {
                    return null;
                }
                Inspector key = obj.field("key");
                Inspector value = obj.field("value");
                if (! key.valid()) return null;
                if (! value.valid()) return null;
                if (key.type() != Type.STRING && !settings.jsonMapsAll) {
                    return null;
                }
                if (settings.convertDeep()) {
                    value = deepMaybeConvert(value);
                }
                if (key.type() == Type.STRING) {
                    map.put(key.asString(), value);
                } else {
                    map.put(WithBase64.toJsonString(key, settings.enableRawAsBase64), value);
                }
            }
            return map;
        }
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