User Profile JSON
This example shows how the viewer handles nested objects like user profiles with multiple levels of data.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "user": {4 "id": 12345,5 "name": "John Doe",6 "email": "john@example.com",7 "profile": {8 "avatar": "https://example.com/avatar.jpg",9 "bio": "Software developer",10 "social": {11 "twitter": "@johndoe",12 "github": "johndoe"13 }14 },15 "settings": {16 "theme": "dark",17 "notifications": true18 }19 }20};2122// Access nested values23function getValue(obj, path) {24 return path.split('.').reduce((acc, key) => acc?.[key], obj);25}2627// Get all paths in JSON28function getAllPaths(obj, prefix = '') {29 const paths = [];30 for (const [key, value] of Object.entries(obj)) {31 const path = prefix ? `${prefix}.${key}` : key;32 paths.push(path);33 if (typeof value === 'object' && value !== null) {34 paths.push(...getAllPaths(value, path));35 }36 }37 return paths;38}3940console.log(getAllPaths(jsonData));
More JSON Examples
Paginated API Response
Explore a paginated API response with items array and metadata.
Package.json Viewer
Explore a Node.js package.json file structure.
GraphQL Response Viewer
Explore a GraphQL API response with nested data and errors.
Kubernetes Config Viewer
Explore Kubernetes deployment configuration in JSON format.
MongoDB Document Viewer
Explore a MongoDB document with ObjectIds and embedded documents.