Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!