GraphQL Response Viewer
Explore GraphQL responses with their typical nested structure including edges, nodes, and pageInfo.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "data": {4 "user": {5 "id": "usr_123",6 "username": "johndoe",7 "email": "john@example.com",8 "posts": {9 "edges": [10 {11 "node": {12 "id": "post_1",13 "title": "Getting Started with GraphQL",14 "publishedAt": "2024-01-10T09:00:00Z",15 "likes": 4216 }17 },18 {19 "node": {20 "id": "post_2",21 "title": "Advanced Query Patterns",22 "publishedAt": "2024-01-15T14:30:00Z",23 "likes": 2824 }25 }26 ],27 "pageInfo": {28 "hasNextPage": true,29 "endCursor": "cursor_abc123"30 }31 }32 }33 },34 "extensions": {35 "complexity": 15,36 "requestId": "req_xyz789"37 }38};3940// Access nested values41function getValue(obj, path) {42 return path.split('.').reduce((acc, key) => acc?.[key], obj);43}4445// Get all paths in JSON46function getAllPaths(obj, prefix = '') {47 const paths = [];48 for (const [key, value] of Object.entries(obj)) {49 const path = prefix ? `${prefix}.${key}` : key;50 paths.push(path);51 if (typeof value === 'object' && value !== null) {52 paths.push(...getAllPaths(value, path));53 }54 }55 return paths;56}5758console.log(getAllPaths(jsonData));
More JSON Examples
User Profile JSON
Explore a typical user profile JSON object with nested data.
Paginated API Response
Explore a paginated API response with items array and metadata.
Package.json Viewer
Explore a Node.js package.json file structure.
Kubernetes Config Viewer
Explore Kubernetes deployment configuration in JSON format.
MongoDB Document Viewer
Explore a MongoDB document with ObjectIds and embedded documents.