Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

parsing through json without using key value python

data = [
  {
    "id": 1,
    "name": "Leanne Graham",
    "username": "Bret",
    "email": "Sincere@april.biz",
    "address": {
      "street": "Kulas Light",
      "suite": "Apt. 556",
      "city": "Gwenborough",
      "zipcode": "92998-3874",
      "geo": {
        "lat": "-37.3159",
        "lng": "81.1496"
      }
    },
    "phone": "1-770-736-8031 x56442",
    "website": "hildegard.org",
    "company": {
      "name": "Romaguera-Crona",
      "catchPhrase": "Multi-layered client-server neural-net",
      "bs": "harness real-time e-markets"
    },
    "other": ["This", "is", "a list"]
  },
  {
    "id": 2,
    "name": "Ervin Howell",
    "username": "Antonette",
    "email": "Shanna@melissa.tv",
    "address": {
      "street": "Victor Plains",
      "suite": "Suite 879",
      "city": "Wisokyburgh",
      "zipcode": "90566-7771",
      "geo": {
        "lat": "-43.9509",
        "lng": "-34.4618"
      }
    },
    "phone": "010-692-6593 x09125",
    "website": "anastasia.net",
    "company": {
      "name": "Deckow-Crist",
      "catchPhrase": "Proactive didactic contingency",
      "bs": "synergize scalable supply-chains"
    },
    "other": ["This", "is", "another list"]
  },
]    

def show_indices(obj, indices):
    for k, v in obj.items() if isinstance(obj, dict) else enumerate(obj):
        if isinstance(v, (dict, list)):
            yield from show_indices(v, indices + [k])
        else:
            yield indices + [k], v

for keys, v in show_indices(data, []):
    print(keys, v)
Comment

PREVIOUS NEXT
Code Example
Javascript :: terrain generator in javascript 
Javascript :: jquery not calling id from div called in ajax 
Javascript :: n JavaScript, select your <h1 element and give it some text 
Javascript :: slack icon emoji for alertmanager 
Javascript :: JavaScript Populating a Hash 
Javascript :: alaa 201 exam 
Javascript :: android intent data as jsonobject 
Javascript :: u017f javascript 
Javascript :: js im mobile hover id 
Javascript :: how display same paragraph in all pages of website in js 
Javascript :: javascript random six digit number with animation 
Javascript :: react router not working with aws amplify 
Javascript :: dojo create app 
Javascript :: onclick show 10 elements 
Javascript :: place white and black knights on 2x2 chessboard 
Javascript :: this rule in js:medium 
Javascript :: serach for a keyword jquery 
Javascript :: how to know if express is intalled 
Javascript :: js remove plus 
Javascript :: copy link url javascript 
Javascript :: discord.js create channel 
Javascript :: ex:java script 
Javascript :: database number counter animation javascript from database 
Javascript :: Minimize DOM access - JavaScript 
Javascript :: form to object function 
Javascript :: para incluir los packetes pero como dependencias de desarrollo. 
Javascript :: Start and Daemonize any application nodejs 
Javascript :: 5.1.1. Boolean Values¶ 
Javascript :: event pooling in react/event.persist/using async function in event callback 
Javascript :: Cannot load gulp: ReferenceError: primordials is not defined 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =