Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda