from jsonpath_ng import parse expr = parse('$[*][*].elementInfo?.singleDataInfo?.image') matches = expr.find(your_json_data) image_values = [match.value for match in matches] url='https://img.meituan.net/mallimages/exhibition-element-aORQUQ1SOk-1748311531095.png' def ocr_1(img_url): import requests from io import BytesIO url = "http://192.168.5.2:9002/infer" # img_url = 'https://p0.meituan.net/mallimages/04e59006293302d0808a5e9bff01d17a79341.png' img_response = requests.get(img_url, timeout=10) img_response.raise_for_status() img_file = BytesIO(img_response.content) files = {"file": ("your.jpg", img_file, "image/jpeg")} r = requests.post(url, files=files, timeout=60) return r.json()['full_text'] print(ocr_1(url))