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

168
Vistas
How to transform a data which is list of dictionaries to a dictionary of dictionaries with key being one of the value in inner dicts in Snowflake

How to transform a data which is list of dictionaries to a dictionary of dictionaries with key being one of the value in inner dicts in Snowflake.

Context: The values I want to transform are in a cell of a table, i am trying to replace that cell with a transformed format.

I am trying to find ways to the task above in two ways. 1. SnowflakeSQL 2. Javascript UDF This is a value in one of the cells in a table.

[
{
  "Vehicle_type": "P",
  "Vehicle_year": "2022",
  "KEY": "key_98765"
},

{
  "Vehicle_type": "Q",
  "Vehicle_year": "2019",
  "KEY": "key_12345"
}
]

I want this to be transformed to

  {
'key_98765':
{
  "Vehicle_type": "P",
  "Vehicle_year": "2022",
  "KEY": "key_98765"
},
'key_12345':
{
  "Vehicle_type": "Q",
  "Vehicle_year": "2019",
  "KEY": "key_12345"
}

}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do it like this:

script

let arr = [
  {
    "Vehicle_type": "P",
    "Vehicle_year": "2022",
    "KEY": "key_98765"
  },
  {
    "Vehicle_type": "Q",
    "Vehicle_year": "2019",
    "KEY": "key_12345"
  },
];

let arrWithKeys = [];

arr.forEach((value => {
  arrWithKeys.push({ [value["KEY"]]: value });
}))

console.log(arrWithKeys);

about 4 years ago · Juan Pablo Isaza Denunciar
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