Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created July 31, 2023 15:34
Show Gist options
  • Save suhailgupta03/b90a7a9d41a6d7247ba941e82c357cfa to your computer and use it in GitHub Desktop.
Save suhailgupta03/b90a7a9d41a6d7247ba941e82c357cfa to your computer and use it in GitHub Desktop.
let student = {
name: 'manoj',
age: 20,
course: 'cse',
college: 'svec',
parentNameList: ['girish', 'samita'],
};
var convertedToString = JSON.stringify(student);
// JSON is a string representation of an object
// In JSON the keys are always wrapped in double quotes
// and the values are either wrapped in double quotes or not
// This is also called serialization
console.log(convertedToString);
var convertedToObject = JSON.parse(convertedToString);
// This is also called deserialization
console.log(convertedToObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment