Kubernetes Config Viewer
Navigate Kubernetes deployment specs, container configurations, and resource limits easily.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "apiVersion": "apps/v1",4 "kind": "Deployment",5 "metadata": {6 "name": "nginx-deployment",7 "labels": {8 "app": "nginx",9 "environment": "production"10 }11 },12 "spec": {13 "replicas": 3,14 "selector": {15 "matchLabels": {16 "app": "nginx"17 }18 },19 "template": {20 "metadata": {21 "labels": {22 "app": "nginx"23 }24 },25 "spec": {26 "containers": [27 {28 "name": "nginx",29 "image": "nginx:1.21",30 "ports": [31 {32 "containerPort": 8033 }34 ],35 "resources": {36 "limits": {37 "cpu": "500m",38 "memory": "128Mi"39 },40 "requests": {41 "cpu": "250m",42 "memory": "64Mi"43 }44 }45 }46 ]47 }48 }49 }50};5152// Access nested values53function getValue(obj, path) {54 return path.split('.').reduce((acc, key) => acc?.[key], obj);55}5657// Get all paths in JSON58function getAllPaths(obj, prefix = '') {59 const paths = [];60 for (const [key, value] of Object.entries(obj)) {61 const path = prefix ? `${prefix}.${key}` : key;62 paths.push(path);63 if (typeof value === 'object' && value !== null) {64 paths.push(...getAllPaths(value, path));65 }66 }67 return paths;68}6970console.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.
MongoDB Document Viewer
Explore a MongoDB document with ObjectIds and embedded documents.