How to convert object to string in react js

How to convert object to string in react js

Posted by Ervin Adams on July 2, 2022

How to convert object to string in react js

How to convert object to string in react js

Posted by Ervin Adams on July 2, 2022

You may sometimes want to store an object to use later. In order to do this, the object can be converted into a string.

This is how you convert object to string:

JSON.stringify({username:"jane", email:"jane@gmail.com"l})

To convert string back to object in order to access the data just do this:

const userInfo = JSON.parse(object)

 

Any question?
This field is required
Your question have been successfully submitted and will be reviewed before published
Please login to ask a question