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

219
Vistas
Deep copying a struct fetched from a smart contract (web3js) in JavaScript

I'm trying to deep-copy in JavaScript a struct from my Solidity smart contract, which is fetched using web3js

This is how I do it:

 participant = await this.state.ContractInstance.methods.retrieveParticipant(0).call();
 let deepParticipant = JSON.parse(JSON.stringify(participants));

A) If I console.log() the participant variable, this is what I get enter image description here B) If I console.log() the deepParticipant variable (the deep clone) I get this enter image description here

They are not the same.

So the question is: How do I get a perfect deep copy of it? I also tried cloning using Lodash and the results are no better.

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