SlideShare a Scribd company logo
Json.parse() in JavaScript
JSON.parse() takes a JSON string and transforms it
into a JavaScript object.
Syntax:
JSON.parse( stringValue, [reviver] );
- stringValue JSON-string to parse
- reviver function(key, value), function to
transform the value
const json = ‘{"string":"Hello
Nugget!","number":123456,
"boolean":false,"test":null}’;
let obj = JSON.parse(json);
console.log(obj);
console.log(obj.string);
//Output
{
string: “Hello Nugget!”,
number: 123456,
boolean: false,
null: null
}
Hello Nugget!
// Output
{
string: “Hello Nugget!”,
number: 123456,
boolean: “setting true”,
null: null
}
true
JSON.parse(jsonString, function(key, value) {
// some operation
// return value for the key
return value;
});
Using reviver function:
This function is to modify the result before
returning.
let obj = JSON.parse(json,
(key, value) => {
return key === ‘boolean’ ?
‘setting true’: true
});
console.log(obj);
console.log(obj.boolean);
Ad

More Related Content

What's hot (20)

An Introduction to WebWorker - 01.26.12
An Introduction to WebWorker - 01.26.12An Introduction to WebWorker - 01.26.12
An Introduction to WebWorker - 01.26.12
Digiflare
 
Async js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaAsync js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgaria
HackBulgaria
 
Better react/redux apps using redux-saga
Better react/redux apps using redux-sagaBetter react/redux apps using redux-saga
Better react/redux apps using redux-saga
Younes (omar) Meliani
 
Javascript this keyword
Javascript this keywordJavascript this keyword
Javascript this keyword
Pham Huy Tung
 
JavaScript, TypeScipt and React Native
JavaScript, TypeScipt and React NativeJavaScript, TypeScipt and React Native
JavaScript, TypeScipt and React Native
Mitchell Tilbrook
 
Ejercicios
EjerciciosEjercicios
Ejercicios
leonharo
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
Thomas Roch
 
Kotlin wonderland
Kotlin wonderlandKotlin wonderland
Kotlin wonderland
Jedsada Tiwongvokul
 
JavaScript promise
JavaScript promiseJavaScript promise
JavaScript promise
eslam_me
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
Mahmoud Samir Fayed
 
Aspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdutionAspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdution
Adriano Mendes
 
Async History - javascript
Async History - javascriptAsync History - javascript
Async History - javascript
Nishchit Dhanani
 
Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovy
Vijay Shukla
 
Engineering JavaScript
Engineering JavaScriptEngineering JavaScript
Engineering JavaScript
Jim Purbrick
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
 
Minion pool - a worker pool for nodejs
Minion pool - a worker pool for nodejsMinion pool - a worker pool for nodejs
Minion pool - a worker pool for nodejs
Marcelo Gornstein
 
JS Objects manipulation
JS Objects manipulationJS Objects manipulation
JS Objects manipulation
City University of Macau
 
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Χρήση Vba για την πρόσβαση σε βάση δεδομένωνΧρήση Vba για την πρόσβαση σε βάση δεδομένων
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Nikos Mpalatsoukas
 
New feature of async fakeAsync test in angular
New feature of async fakeAsync test in angularNew feature of async fakeAsync test in angular
New feature of async fakeAsync test in angular
Jia Li
 
Javascript Execution Context Flow
Javascript Execution Context FlowJavascript Execution Context Flow
Javascript Execution Context Flow
kang taehun
 
An Introduction to WebWorker - 01.26.12
An Introduction to WebWorker - 01.26.12An Introduction to WebWorker - 01.26.12
An Introduction to WebWorker - 01.26.12
Digiflare
 
Async js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgariaAsync js - Nemetschek Presentaion @ HackBulgaria
Async js - Nemetschek Presentaion @ HackBulgaria
HackBulgaria
 
Better react/redux apps using redux-saga
Better react/redux apps using redux-sagaBetter react/redux apps using redux-saga
Better react/redux apps using redux-saga
Younes (omar) Meliani
 
Javascript this keyword
Javascript this keywordJavascript this keyword
Javascript this keyword
Pham Huy Tung
 
JavaScript, TypeScipt and React Native
JavaScript, TypeScipt and React NativeJavaScript, TypeScipt and React Native
JavaScript, TypeScipt and React Native
Mitchell Tilbrook
 
Ejercicios
EjerciciosEjercicios
Ejercicios
leonharo
 
Callbacks and control flow in Node js
Callbacks and control flow in Node jsCallbacks and control flow in Node js
Callbacks and control flow in Node js
Thomas Roch
 
JavaScript promise
JavaScript promiseJavaScript promise
JavaScript promise
eslam_me
 
The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
Mahmoud Samir Fayed
 
Aspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdutionAspdevice - Asp Fast Crud introdution
Aspdevice - Asp Fast Crud introdution
Adriano Mendes
 
Async History - javascript
Async History - javascriptAsync History - javascript
Async History - javascript
Nishchit Dhanani
 
Engineering JavaScript
Engineering JavaScriptEngineering JavaScript
Engineering JavaScript
Jim Purbrick
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
 
Minion pool - a worker pool for nodejs
Minion pool - a worker pool for nodejsMinion pool - a worker pool for nodejs
Minion pool - a worker pool for nodejs
Marcelo Gornstein
 
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Χρήση Vba για την πρόσβαση σε βάση δεδομένωνΧρήση Vba για την πρόσβαση σε βάση δεδομένων
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Nikos Mpalatsoukas
 
New feature of async fakeAsync test in angular
New feature of async fakeAsync test in angularNew feature of async fakeAsync test in angular
New feature of async fakeAsync test in angular
Jia Li
 
Javascript Execution Context Flow
Javascript Execution Context FlowJavascript Execution Context Flow
Javascript Execution Context Flow
kang taehun
 

Similar to Json.parse() in JavaScript (20)

Scala in practice
Scala in practiceScala in practice
Scala in practice
andyrobinson8
 
Jason parsing
Jason parsingJason parsing
Jason parsing
parallelminder
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bits
Chris Saylor
 
Let's JavaScript
Let's JavaScriptLet's JavaScript
Let's JavaScript
Paweł Dorofiejczyk
 
Javascript
JavascriptJavascript
Javascript
Aditya Gaur
 
front-end dev
front-end devfront-end dev
front-end dev
Paul Comanici
 
quick json parser
quick json parserquick json parser
quick json parser
Rajesh Putta
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
Bruno Scopelliti
 
JavaScript Execution Context
JavaScript Execution ContextJavaScript Execution Context
JavaScript Execution Context
Juan Medina
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
Mohammed Irfan Shaikh
 
javascript function & closure
javascript function & closurejavascript function & closure
javascript function & closure
Hika Maeng
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
patforna
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
priestmanmable
 
JavaScript OOP Pattern
JavaScript OOP PatternJavaScript OOP Pattern
JavaScript OOP Pattern
지수 윤
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
nsm.nikhil
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
Ryan Anklam
 
JavaScript Object API
JavaScript Object APIJavaScript Object API
JavaScript Object API
SRINIVAS KOLAPARTHI
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
Bret Little
 
Underscore and Backbone Models
Underscore and Backbone ModelsUnderscore and Backbone Models
Underscore and Backbone Models
Kentucky JavaScript Users Group
 
jrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeusjrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeus
Takeshi AKIMA
 
Javascript: the important bits
Javascript: the important bitsJavascript: the important bits
Javascript: the important bits
Chris Saylor
 
JavaScript Execution Context
JavaScript Execution ContextJavaScript Execution Context
JavaScript Execution Context
Juan Medina
 
javascript function & closure
javascript function & closurejavascript function & closure
javascript function & closure
Hika Maeng
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
patforna
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
priestmanmable
 
JavaScript OOP Pattern
JavaScript OOP PatternJavaScript OOP Pattern
JavaScript OOP Pattern
지수 윤
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
nsm.nikhil
 
Stop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScriptStop Making Excuses and Start Testing Your JavaScript
Stop Making Excuses and Start Testing Your JavaScript
Ryan Anklam
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
Bret Little
 
jrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeusjrubykaigi2010-lt-rubeus
jrubykaigi2010-lt-rubeus
Takeshi AKIMA
 
Ad

More from Ideas2IT Technologies (20)

Version comaparison in JavaScript
Version comaparison in JavaScriptVersion comaparison in JavaScript
Version comaparison in JavaScript
Ideas2IT Technologies
 
Currying in JavaScript
Currying in JavaScriptCurrying in JavaScript
Currying in JavaScript
Ideas2IT Technologies
 
JS Testing Frameworks
JS Testing FrameworksJS Testing Frameworks
JS Testing Frameworks
Ideas2IT Technologies
 
Cool usage of Encoding and Decoding a URI in Javascript
Cool usage of Encoding and Decoding a URI in JavascriptCool usage of Encoding and Decoding a URI in Javascript
Cool usage of Encoding and Decoding a URI in Javascript
Ideas2IT Technologies
 
Iterables and Iterators in JavaScript
Iterables and Iterators in JavaScriptIterables and Iterators in JavaScript
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
String comparison in javascript
String comparison in javascriptString comparison in javascript
String comparison in javascript
Ideas2IT Technologies
 
JavaScript symbols
JavaScript symbolsJavaScript symbols
JavaScript symbols
Ideas2IT Technologies
 
Bubble sort in Java Script
Bubble sort in Java ScriptBubble sort in Java Script
Bubble sort in Java Script
Ideas2IT Technologies
 
Performance analysis in merging arrays - JavaScript
Performance analysis in merging arrays - JavaScriptPerformance analysis in merging arrays - JavaScript
Performance analysis in merging arrays - JavaScript
Ideas2IT Technologies
 
Nullish coalescing in JavaScript
Nullish coalescing in JavaScriptNullish coalescing in JavaScript
Nullish coalescing in JavaScript
Ideas2IT Technologies
 
Conditionally add keys in JavaScript
Conditionally add keys in JavaScriptConditionally add keys in JavaScript
Conditionally add keys in JavaScript
Ideas2IT Technologies
 
What is Big O in JavaScript - Part-1
What is Big O in JavaScript - Part-1What is Big O in JavaScript - Part-1
What is Big O in JavaScript - Part-1
Ideas2IT Technologies
 
Variable hoisting in JavaScript
Variable hoisting in JavaScriptVariable hoisting in JavaScript
Variable hoisting in JavaScript
Ideas2IT Technologies
 
Formidable ES6 spread operator in JavaScript
Formidable ES6 spread operator in JavaScriptFormidable ES6 spread operator in JavaScript
Formidable ES6 spread operator in JavaScript
Ideas2IT Technologies
 
Logging in JavaScript - Part-5
Logging in JavaScript - Part-5Logging in JavaScript - Part-5
Logging in JavaScript - Part-5
Ideas2IT Technologies
 
Logging in JavaScript - Part-4
Logging in JavaScript - Part-4Logging in JavaScript - Part-4
Logging in JavaScript - Part-4
Ideas2IT Technologies
 
Logging in JavaScript - Part-3
Logging in JavaScript - Part-3Logging in JavaScript - Part-3
Logging in JavaScript - Part-3
Ideas2IT Technologies
 
Logging in JavaScript - part-2
Logging in JavaScript - part-2Logging in JavaScript - part-2
Logging in JavaScript - part-2
Ideas2IT Technologies
 
Logging in JavaScript - part-1
Logging in JavaScript - part-1Logging in JavaScript - part-1
Logging in JavaScript - part-1
Ideas2IT Technologies
 
Array vs set in JavaScript
Array vs set in JavaScriptArray vs set in JavaScript
Array vs set in JavaScript
Ideas2IT Technologies
 
Cool usage of Encoding and Decoding a URI in Javascript
Cool usage of Encoding and Decoding a URI in JavascriptCool usage of Encoding and Decoding a URI in Javascript
Cool usage of Encoding and Decoding a URI in Javascript
Ideas2IT Technologies
 
Iterables and Iterators in JavaScript
Iterables and Iterators in JavaScriptIterables and Iterators in JavaScript
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
Performance analysis in merging arrays - JavaScript
Performance analysis in merging arrays - JavaScriptPerformance analysis in merging arrays - JavaScript
Performance analysis in merging arrays - JavaScript
Ideas2IT Technologies
 
Conditionally add keys in JavaScript
Conditionally add keys in JavaScriptConditionally add keys in JavaScript
Conditionally add keys in JavaScript
Ideas2IT Technologies
 
What is Big O in JavaScript - Part-1
What is Big O in JavaScript - Part-1What is Big O in JavaScript - Part-1
What is Big O in JavaScript - Part-1
Ideas2IT Technologies
 
Formidable ES6 spread operator in JavaScript
Formidable ES6 spread operator in JavaScriptFormidable ES6 spread operator in JavaScript
Formidable ES6 spread operator in JavaScript
Ideas2IT Technologies
 
Ad

Recently uploaded (20)

F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Top 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdfTop 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdf
AffinityCore
 
Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025
fs4635986
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Top 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdfTop 10 Data Cleansing Tools for 2025.pdf
Top 10 Data Cleansing Tools for 2025.pdf
AffinityCore
 
Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025Apple Logic Pro X Crack FRESH Version 2025
Apple Logic Pro X Crack FRESH Version 2025
fs4635986
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Microsoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptxMicrosoft Excel Core Points Training.pptx
Microsoft Excel Core Points Training.pptx
Mekonnen
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
PRTG Network Monitor Crack Latest Version & Serial Key 2025 [100% Working]
saimabibi60507
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Full Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest VersionFull Cracked Resolume Arena Latest Version
Full Cracked Resolume Arena Latest Version
jonesmichealj2
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 

Json.parse() in JavaScript

  • 2. JSON.parse() takes a JSON string and transforms it into a JavaScript object. Syntax: JSON.parse( stringValue, [reviver] ); - stringValue JSON-string to parse - reviver function(key, value), function to transform the value const json = ‘{"string":"Hello Nugget!","number":123456, "boolean":false,"test":null}’; let obj = JSON.parse(json); console.log(obj); console.log(obj.string); //Output { string: “Hello Nugget!”, number: 123456, boolean: false, null: null } Hello Nugget!
  • 3. // Output { string: “Hello Nugget!”, number: 123456, boolean: “setting true”, null: null } true JSON.parse(jsonString, function(key, value) { // some operation // return value for the key return value; }); Using reviver function: This function is to modify the result before returning. let obj = JSON.parse(json, (key, value) => { return key === ‘boolean’ ? ‘setting true’: true }); console.log(obj); console.log(obj.boolean);