Package.json Viewer
Navigate through a package.json file to find dependencies, scripts, and configuration.
Code Examples
Here's how to achieve this in different programming languages:
1// Parse and traverse JSON2const jsonData = {3 "name": "my-project",4 "version": "1.0.0",5 "description": "A sample project",6 "main": "index.js",7 "scripts": {8 "dev": "next dev",9 "build": "next build",10 "start": "next start",11 "test": "jest"12 },13 "dependencies": {14 "react": "^18.2.0",15 "next": "^14.0.0",16 "typescript": "^5.0.0"17 },18 "devDependencies": {19 "@types/node": "^20.0.0",20 "@types/react": "^18.2.0",21 "eslint": "^8.0.0"22 }23};2425// Access nested values26function getValue(obj, path) {27 return path.split('.').reduce((acc, key) => acc?.[key], obj);28}2930// Get all paths in JSON31function getAllPaths(obj, prefix = '') {32 const paths = [];33 for (const [key, value] of Object.entries(obj)) {34 const path = prefix ? `${prefix}.${key}` : key;35 paths.push(path);36 if (typeof value === 'object' && value !== null) {37 paths.push(...getAllPaths(value, path));38 }39 }40 return paths;41}4243console.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.
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.