如何修复Google Sheets中IMPORTJSON的XPath路径以获取algo列表?
Let's break down why you're seeing that error and how to resolve it:
Why your original formula fails
The Mining Pool Hub API returns a JSON structure where the return key contains an array of objects, not a direct object with an algo property. Your original path "return/algo" tries to access an algo field directly under return, but that node doesn't exist—each element inside the return array has the algo field instead.
The corrected formula
You need to use a wildcard * to iterate through every item in the return array, then pull the algo field from each entry. Here's the fixed formula:
=IMPORTJSON("http://miningpoolhub.com/index.php?page=api&action=getminingandprofitsstatistics", "return/*/algo")
Optional tweak for cleaner output
If you want to skip the auto-generated header row, add the third parameter "noHeaders" to suppress it:
=IMPORTJSON("http://miningpoolhub.com/index.php?page=api&action=getminingandprofitsstatistics", "return/*/algo", "noHeaders")
Quick sanity check
To confirm the JSON structure, just paste the API URL into your browser—you'll see that return is an array, and each entry in that array includes the algo property. This confirms the wildcard path is the correct approach.
内容的提问来源于stack exchange,提问作者Deividas

