MongoDB Document Viewer
Explore MongoDB documents with their extended JSON types like $oid and $date.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "_id": {4 "$oid": "507f1f77bcf86cd799439011"5 },6 "orderNumber": "ORD-2024-001",7 "customer": {8 "_id": {9 "$oid": "507f1f77bcf86cd799439022"10 },11 "name": "Jane Smith",12 "email": "jane@example.com",13 "address": {14 "street": "456 Oak Avenue",15 "city": "San Francisco",16 "state": "CA",17 "zip": "94102"18 }19 },20 "items": [21 {22 "productId": {23 "$oid": "507f1f77bcf86cd799439033"24 },25 "name": "Wireless Keyboard",26 "quantity": 2,27 "price": 79.9928 },29 {30 "productId": {31 "$oid": "507f1f77bcf86cd799439044"32 },33 "name": "USB-C Hub",34 "quantity": 1,35 "price": 49.9936 }37 ],38 "totals": {39 "subtotal": 209.97,40 "tax": 18.9,41 "shipping": 9.99,42 "total": 238.8643 },44 "status": "shipped",45 "createdAt": {46 "$date": "2024-01-15T10:30:00Z"47 },48 "updatedAt": {49 "$date": "2024-01-16T14:22:00Z"50 }51};5253// Access nested values54function getValue(obj, path) {55 return path.split('.').reduce((acc, key) => acc?.[key], obj);56}5758// Get all paths in JSON59function getAllPaths(obj, prefix = '') {60 const paths = [];61 for (const [key, value] of Object.entries(obj)) {62 const path = prefix ? `${prefix}.${key}` : key;63 paths.push(path);64 if (typeof value === 'object' && value !== null) {65 paths.push(...getAllPaths(value, path));66 }67 }68 return paths;69}7071console.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.
GraphQL Response Viewer
Explore a GraphQL API response with nested data and errors.
Kubernetes Config Viewer
Explore Kubernetes deployment configuration in JSON format.