function gremlinElementToJson()

in templates/JSResolverOCHTTPS.js [983:1010]


function gremlinElementToJson(o, fieldsAlias) {
    let data = '';        
    let isKey = true;
    data += '{';
    o['@value'].forEach(v => {
        if (v['@value'] != undefined) {
            if (v['@value'] == 'label')
                data += '"type":';
            if (v['@value'] == 'id') 
                //data += '"id":';
                data += '"' + fieldsAlias["id"] + '":';
            if (v['@type'] == 'g:Int32' || v['@type'] == 'g:Double' || v['@type'] == 'g:Int64')
                data += v['@value'] + ', ';
            isKey = !isKey;            
        } else {
            if (isKey) {
                data += '"' + fieldsAlias[v] + '":';
                isKey = false;
            } else {
                data += '"' + v + '", ';
                isKey = true;
            }
        }
    });
    data = data.substring(0, data.length - 2);
    data += '}';        
    return data;
}