JavaScript JSON Objects Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report JSON (JavaScript Object Notation) is a handy way to share data. It's easy for both people and computers to understand. In JavaScript, JSON helps organize data into simple objects. Let's explore how JSON works and why it's so useful for exchanging information.const jsonData = { "key1" : "value1", ... }; JavaScript const person = { "name": "John", "age": 30, "city": "New York" }; Explanation:{ } - Curly braces define the object."name", "age", "city" - These are the keys (properties) of the object. Keys are always strings."John", 30, "New York" - These are the corresponding values associated with each key.: - Colon(:) separates keys and values., - Comma(,) separates different key-value pairs within the object.Accessing JSON Object ValuesThe object values can be accessed by using the dot (".") notation.We can also access objects by using bracket([]) notation. JavaScript let myOrder, i; // Object is created with name myOrder myOrder = { "name_of_the_product": "Earbuds", "cost": "799", "warranty": "1 year " }; // Accessing for particular detail // from object myOrder i = myOrder.name_of_the_product; // It prints the detail of name // of the product console.log(i); OutputEarbuds Looping through JSON ObjectLooping can be done in two ways:Looping of an object can be done by using a property for-in loop.For looping an object we can even use brackets ("[]") in the for-in loop property. JavaScript let myOrder, a; myOrder = { "name_of_product": "earbuds", "cost": "799", "warranty": "1 year" }; for (a in myOrder) { // Accessing object in looping // using bracket notation console.log(myOrder[a]); } Outputearbuds 799 1 year Converting a JSON Text to a JavaScript ObjectTo convert a JSON text to a JavaScript object, you can use the JSON.parse() method. JavaScript const jsonString = '{"name": "GFG", "age": 30}'; const jsonObject = JSON.parse(jsonString); console.log(jsonObject.name); console.log(jsonObject.age); OutputGFG 30 JavaScript JSON Objects -FAQ's What is JSON and why is it used?JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is widely used for transmitting data between a server and web application as a text string.How do you create a JSON object?You create a JSON object by enclosing key-value pairs within curly braces {}, where keys are always strings and values can be any valid JSON data type (string, number, object, array, boolean, or null).How do you access values in a JSON object?You can access values in a JSON object using either dot notation (jsonData.key) or bracket notation (jsonData['key']). Dot notation is used when you know the key beforehand, while bracket notation is useful when the key is dynamic or stored in a variable. Comment More infoAdvertise with us K kadiummanisha Follow Improve Article Tags : JavaScript javascript-basics JSON Explore JavaScript Tutorial 8 min read JavaScript BasicsIntroduction to JavaScript 4 min read JavaScript Versions 2 min read How to Add JavaScript in HTML Document? 3 min read JavaScript Syntax 6 min read JavaScript Output 4 min read JavaScript Comments 2 min read JS Variables & DatatypesVariables and Datatypes in JavaScript 6 min read Global and Local variables in JavaScript 4 min read JavaScript Let 6 min read JavaScript const 5 min read JavaScript Var Statement 7 min read JS OperatorsJavaScript Operators 5 min read Operator precedence in JavaScript 2 min read JavaScript Arithmetic Operators 5 min read JavaScript Assignment Operators 5 min read JavaScript Comparison Operators 5 min read JavaScript Logical Operators 5 min read JavaScript Bitwise Operators 5 min read JavaScript Ternary Operator 4 min read JavaScript Comma Operator 2 min read JavaScript Unary Operators 4 min read JavaScript in and instanceof operators 3 min read JavaScript String Operators 3 min read JS StatementsJavaScript Statements 4 min read JavaScript if-else 3 min read JavaScript switch Statement 4 min read JavaScript Break Statement 2 min read JavaScript Continue Statement 1 min read JavaScript Return Statement 4 min read JS LoopsJavaScript Loops 3 min read JavaScript For Loop 4 min read JavaScript While Loop 3 min read JavaScript For In Loop 3 min read JavaScript for...of Loop 3 min read JavaScript do...while Loop 4 min read JS Perfomance & DebuggingJavaScript | Performance 4 min read Debugging in JavaScript 4 min read JavaScript Errors Throw and Try to Catch 2 min read JS ObjectObjects in Javascript 4 min read Object Oriented Programming in JavaScript 3 min read JavaScript Objects 6 min read Creating objects in JavaScript 5 min read JavaScript JSON Objects 3 min read JavaScript Object Reference 4 min read JS FunctionFunctions in JavaScript 4 min read How to write a function in JavaScript ? 4 min read JavaScript Function Call 2 min read Different ways of writing functions in JavaScript 3 min read Difference between Methods and Functions in JavaScript 3 min read Explain the Different Function States in JavaScript 3 min read JavaScript Function Complete Reference 3 min read JS ArrayJavaScript Arrays 7 min read JavaScript Array Methods 7 min read Best-Known JavaScript Array Methods 6 min read Important Array Methods of JavaScript 7 min read JavaScript Array Reference 4 min read Like