GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — JavaScript JSON Objects - GeeksforGeeks JavaScript JSON ObjectsLast Updated : 26 Oct, 2026 JSON (JavaScript Object Notation) is a lightweight text format used to store and exchange data between applications. ![]()
Creating a JavaScript ObjectJavaScript objects store data as key-value pairs. Although JSON uses a similar structure, a JavaScript object is not the same as JSON text.
Output { name: 'Ben', age: 30, city: 'New York' }
In JSON text, property names must use double quotes, strings must use double quotes, and functions and undefined values are not supported Accessing JavaScript Object PropertiesObject properties can be accessed using dot notation or bracket notation.
Output Earbuds 799 1 year
Looping Through JavaScript Object PropertiesThe for...in loop iterates over an object's enumerable string-keyed properties. Bracket notation can be used to access each property's value.
Output name Earbuds cost 799 warranty 1 year To iterate only over an object's own enumerable properties, use Object.keys(), Object.values(), or Object.entries(), depending on whether you need the keys, values, or both. Converting a JSON String to a JavaScript ObjectThe JSON.parse() method converts a valid JSON string into a JavaScript value, such as an object or array.
Output GFG 30 JSON.parse() throws a SyntaxError if the input contains invalid JSON. Use error handling when parsing JSON from external sources. Converting a JavaScript Object to JSONThe JSON.stringify() method converts a JavaScript value into a JSON string. It is commonly used when sending data to APIs or storing data as text.
Output {"name":"Ben","age":30,"city":"New York"}
JSON.stringify() serializes supported values into JSON text. Some JavaScript values, such as functions and undefined properties, are omitted from objects during serialization. Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |