Paginated API Response
This example demonstrates viewing array data and pagination metadata from a typical REST API response.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "data": {4 "items": [5 {6 "id": 1,7 "name": "Item 1",8 "status": "active"9 },10 {11 "id": 2,12 "name": "Item 2",13 "status": "pending"14 },15 {16 "id": 3,17 "name": "Item 3",18 "status": "active"19 }20 ],21 "pagination": {22 "page": 1,23 "perPage": 10,24 "total": 100,25 "totalPages": 1026 }27 },28 "meta": {29 "requestId": "abc-123",30 "timestamp": "2024-01-15T10:30:00Z"31 }32};3334// Access nested values35function getValue(obj, path) {36 return path.split('.').reduce((acc, key) => acc?.[key], obj);37}3839// Get all paths in JSON40function getAllPaths(obj, prefix = '') {41 const paths = [];42 for (const [key, value] of Object.entries(obj)) {43 const path = prefix ? `${prefix}.${key}` : key;44 paths.push(path);45 if (typeof value === 'object' && value !== null) {46 paths.push(...getAllPaths(value, path));47 }48 }49 return paths;50}5152console.log(getAllPaths(jsonData));
More JSON Examples
User Profile JSON
Explore a typical user profile JSON object with nested data.
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.