Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
Get key element in an object when key is a string containing spaces

I have a json file with content similar to the following

{
    "dlg-4b2edcfb-7fa5-4a93-a82e-8a6637fb5d7a": [
        {
            "utteranceID": 0,
            "speaker": "agent",
            "source": "[UFT]HI, how can i help you?",
            "target": "[UFT]",
            "input formality tone": "unacceptable"
        },
        {
            "utteranceID": 1,
            "speaker": "customer",
            "source": "Hi, could you help me with ordering from Starbucks?",
            "target": "[UFT]",
            "input formality tone": "unacceptable"
        }       
    ]
}

I need to extract values from the key "input formality tone". I already tried this code, but it returns null as result

function test() {
  var file = DriveApp.getFileById("19ncMpYna8VEBCVfvMjbuImFZXPx2Jlw0");
  var filecontent = file.getBlob().getDataAsString();
  var jsonparse = JSON.parse(filecontent);
  for (var key in jsonparse) {
    var arr = jsonparse[key];
    for (var i=0; i<arr.length; i++) {
      var item = arr[i];
      Logger.log(item)
      inputFormalityTone = "input formality tone";
      Logger.log(item.inputFormalityTone)
    }
  }
}

Can you please help me to solve this? Thanks in advance,

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda