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

161
Visualizações
React Native JSON.stringify() corrupts object

I have this which code takes a string (stored in a react hook) and puts it into a JSON object which is them stringified and stored in Async Storage. The value of the string is Client@monroinsights.co

let newModel = {
    email: email,
}
await AsyncStorage.setItem('@onboardingModel', JSON.stringify(newModel))

Whenever I later interact with this item in async storage, the Object looks like this:

"0": "{",
  "1": "\"",
  "10": "C",
  "11": "l",
  "12": "i",
  "13": "e",
  "14": "n",
  "15": "t",
  "16": "@",
  "17": "m",
  "18": "o",
  "19": "n",
  "2": "e",
  "20": "r",
  "21": "o",
  "22": "i",
  "23": "n",
  "24": "s",
  "25": "i",
  "26": "g",
  "27": "h",
  "28": "t",
  "29": "s",
  "3": "m",
  "30": ".",
  "31": "c",
  "32": "o",
  "33": "\"",
  "34": "}",
  "4": "a",
  "5": "i",
  "6": "l",
  "7": "\"",
  "8": ":",
  "9": "\"",

What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It's hard to say what's wrong without seeing the code you've written to retrieve the value from async storage.

Is it possible you're forgetting to resolve the promise returned by getItem, i.e. something equivalent to:

JSON.parse(getItem('@onboardingModel'))

when you should be doing something more like what's shown in this function:

const getOnboardingModel = async () => (
  JSON.parse(await getItem('@onboardingModel'))
)
about 4 years ago · Juan Pablo Isaza Relatório
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