import json from src.identifiers import HAND_LANDMARKS, POSE_LANDMARKS def export_json(pose_landmarks, hand_landmarks, filename): l = { "pose_landmarks": list(pose_landmarks.values()), "hand_landmarks": list(hand_landmarks.values()) } # write l to filename with open(filename, 'w') as f: json.dump(l, f) export_json(POSE_LANDMARKS, HAND_LANDMARKS, "landmarks.json")