This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract_values(obj, key): | |
"""Recursively pull values of specified key from nested JSON.""" | |
arr = [] | |
def extract(obj, arr, key): | |
"""Return all matching values in an object.""" | |
if isinstance(obj, dict): | |
for k, v in obj.items(): | |
if isinstance(v, (dict, list)): | |
extract(v, arr, key) |