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

254
Vistas
How to display the value without the key after JSON.stringify?

I am trying to display the value of a key after using JSON.stringify to collect form data and put into JSON. Now I need the value of a specific key within from this json file but I get the key/value pair:

{"KEY":"KM8IJM12D56U303366"}

Currently my code to display this is:

const onSubmit = async data => {

    // How to get specific data from stringify
    var jsonString = JSON.stringify(data, ["KEY"]);
    alert(jsonString);
    notify();
};

I have tried using getItem() but that seems to only work with local storage. Is there a solution where I can just directly access the value of KEY after JSON.stringify()?

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

0

Amigo, My first suggestion over this would be, Go with the data as Object, don't stringify that.

const onSubmit = async data => {

    // If data is not a Stringify Object:
    var jsonString = JSON.stringify(data.key);
    alert(jsonString);
    notify();

    //********

    // If data is a Stringify Object:
    var jsonString = JSON.parse(data);
    alert(jsonString.key);
    notify();


    
};

But If you want to go with a string:

const onSubmit = async data => {
    // If you want to use only the Key as a string, go with the line below
    var jsonString = data.key.toString();

    // Else Directly access your key by the below line.
    var jsonString = data.key;

    alert(jsonString);
    notify();
};
about 4 years ago · Juan Pablo Isaza Denunciar

0

You would need to JSON.parse() it back to an object to access keys and values. After you apply stringify(), it's a string.

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