How to convert JSON Object to String

If you want to send the JSON object to backend, you should convert the JSON to String format.

See below example,

const json_object = {name:'Nirmal', email: 'admin@owlcoders.com'};

Convert above object to string. Use this javascript function JSON.stringify() to convert object to string

const stringed_json = JSON.stringify(json_object);

stringed_json is now a string.

Now we can easily store this string to server

Leave a Reply

Your email address will not be published. Required fields are marked *