{"id":1565,"date":"2022-08-04T22:04:08","date_gmt":"2022-08-04T16:34:08","guid":{"rendered":"https:\/\/myfreeonlinetools.com\/blog\/?p=1565"},"modified":"2022-08-04T22:04:08","modified_gmt":"2022-08-04T16:34:08","slug":"use-json-parse-and-json-stringify-in-javascript","status":"publish","type":"post","link":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/","title":{"rendered":"use JSON.parse() and JSON.stringify() in JavaScript"},"content":{"rendered":"<h2>How to use JSON.parse() and JSON.stringfy() in JavaScript<\/h2>\n<h3>JSON.parse()<\/h3>\n<p>Its convert JSON String to JavaScript Object. Its help to convert text into JavaScript Object. Use of this method convert JSON string into object and access single values using the dot. So at last its helps to convert JSON String to JS Object. When receiving data from a web server, the data is always a string and parse method help to convert in object.<\/p>\n<p>Syntax<br \/>\nJSON.parse(text, reviver);<\/p>\n<p>Second parameter use in JSON.parse its called reviver. It is a function that checks earh property in JSON, before return value.<\/p>\n<p>Example<\/p>\n<pre>var json='{\"language\":\"JavaScript\"<wbr \/>,\"IDE\":\"Visual Studio Code\",\"theme\":\"dark\"}';\r\nvar obj=JSON.parse(json);\r\nconsole.log(obj);\r\n\r\nResult\r\n{ language: 'JavaScript', IDE: 'Visual Studio Code', theme: 'dark' }<\/pre>\n<h3>\nJSON.stringify()<\/h3>\n<p>When user need to send data to web server the data should into string format so convert JavaScript Object into string with using JSON.stringify.<\/p>\n<p>Its help to convert a object to a string that contain object key value pair and string are store all data. Many times data need to send in string format for stroing into database or send to web server on that time require to convert into string.<\/p>\n<pre>var value = { name: \"Logan\", age: 21, location: \"London\" };\r\nvar result = JSON.stringify(value);\r\n\r\nOutput:\r\n{\"name\":\"Logan\", \"age\":21, \"location\":\"London\"}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to use JSON.parse() and JSON.stringfy() in JavaScript JSON.parse() Its convert JSON String to JavaScript Object. Its help to convert text into JavaScript Object. Use of this method convert JSON [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[23,28,36,21],"tags":[],"class_list":["post-1565","post","type-post","status-publish","format-standard","hentry","category-javascript-tutorial","category-jquery-code","category-json","category-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools\" \/>\n<meta property=\"og:description\" content=\"How to use JSON.parse() and JSON.stringfy() in JavaScript JSON.parse() Its convert JSON String to JavaScript Object. Its help to convert text into JavaScript Object. Use of this method convert JSON [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"MyFreeOnlineTools\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/LearnSchoolOnline\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-04T16:34:08+00:00\" \/>\n<meta name=\"author\" content=\"myfreeonlinetools\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"myfreeonlinetools\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\"},\"author\":{\"name\":\"myfreeonlinetools\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c\"},\"headline\":\"use JSON.parse() and JSON.stringify() in JavaScript\",\"datePublished\":\"2022-08-04T16:34:08+00:00\",\"dateModified\":\"2022-08-04T16:34:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\"},\"wordCount\":186,\"publisher\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\"},\"articleSection\":[\"JavaScript Tutorial\",\"jQuery Code\",\"JSON\",\"Tutorial\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\",\"name\":\"use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools\",\"isPartOf\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#website\"},\"datePublished\":\"2022-08-04T16:34:08+00:00\",\"dateModified\":\"2022-08-04T16:34:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/myfreeonlinetools.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"use JSON.parse() and JSON.stringify() in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#website\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/\",\"name\":\"MyFreeOnlineTools\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/myfreeonlinetools.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\",\"name\":\"MyFreeOnlineTools\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png\",\"contentUrl\":\"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png\",\"width\":387,\"height\":79,\"caption\":\"MyFreeOnlineTools\"},\"image\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c\",\"name\":\"myfreeonlinetools\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g\",\"caption\":\"myfreeonlinetools\"},\"description\":\"Live in Delhi, Working in Gurgaon as Web Designer and Graphic Designer. Developed and Design myfreeonlinetools for online free tools. Also having youtube channel Name with LearnSchoolOnline. Traveling, watching movies, coding are the hobbies.\",\"sameAs\":[\"https:\/\/myfreeonlinetools.com\/\",\"https:\/\/www.facebook.com\/LearnSchoolOnline\/\",\"https:\/\/www.youtube.com\/learnschoolonline\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools","og_description":"How to use JSON.parse() and JSON.stringfy() in JavaScript JSON.parse() Its convert JSON String to JavaScript Object. Its help to convert text into JavaScript Object. Use of this method convert JSON [&hellip;]","og_url":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/","og_site_name":"MyFreeOnlineTools","article_author":"https:\/\/www.facebook.com\/LearnSchoolOnline\/","article_published_time":"2022-08-04T16:34:08+00:00","author":"myfreeonlinetools","twitter_card":"summary_large_image","twitter_misc":{"Written by":"myfreeonlinetools","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#article","isPartOf":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/"},"author":{"name":"myfreeonlinetools","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c"},"headline":"use JSON.parse() and JSON.stringify() in JavaScript","datePublished":"2022-08-04T16:34:08+00:00","dateModified":"2022-08-04T16:34:08+00:00","mainEntityOfPage":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/"},"wordCount":186,"publisher":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization"},"articleSection":["JavaScript Tutorial","jQuery Code","JSON","Tutorial"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/","url":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/","name":"use JSON.parse() and JSON.stringify() in JavaScript - MyFreeOnlineTools","isPartOf":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#website"},"datePublished":"2022-08-04T16:34:08+00:00","dateModified":"2022-08-04T16:34:08+00:00","breadcrumb":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/myfreeonlinetools.com\/blog\/use-json-parse-and-json-stringify-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/myfreeonlinetools.com\/blog\/"},{"@type":"ListItem","position":2,"name":"use JSON.parse() and JSON.stringify() in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/myfreeonlinetools.com\/blog\/#website","url":"https:\/\/myfreeonlinetools.com\/blog\/","name":"MyFreeOnlineTools","description":"","publisher":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/myfreeonlinetools.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization","name":"MyFreeOnlineTools","url":"https:\/\/myfreeonlinetools.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png","contentUrl":"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png","width":387,"height":79,"caption":"MyFreeOnlineTools"},"image":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c","name":"myfreeonlinetools","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g","caption":"myfreeonlinetools"},"description":"Live in Delhi, Working in Gurgaon as Web Designer and Graphic Designer. Developed and Design myfreeonlinetools for online free tools. Also having youtube channel Name with LearnSchoolOnline. Traveling, watching movies, coding are the hobbies.","sameAs":["https:\/\/myfreeonlinetools.com\/","https:\/\/www.facebook.com\/LearnSchoolOnline\/","https:\/\/www.youtube.com\/learnschoolonline"]}]}},"_links":{"self":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/comments?post=1565"}],"version-history":[{"count":0,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1565\/revisions"}],"wp:attachment":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/media?parent=1565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/categories?post=1565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/tags?post=1565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}