我的YahooAPI调用如下:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url=%22https://xgcwallet.org/ex/GetWebTransactions/18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe%22&format=json&callback=
给了我结果:
{"query":{"count":1,"created":"2015-08-17T19:32:10Z","lang":"en-us","results":{
"json":{"_5c5731a04b825c46e9642bc12685db8dc7c4c367e022ac6ba95ee166024873e":{
"hash":"75c5731a04b825c46e9642bc12685db8dc7c4c367e022ac6ba95ee166024873e","ver":"1","in":{
"prev_out":{
"hash":"27e841f82d44f82bdc1a2e6de162f3b133aa9db1372ce02f86f057a46555e35e","n":"0"},
"address":"18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe"},
"out":[
{"value":"1",
"n":"0",
"scriptPubKey":"OP_DUP OP_HASH160 9b92ebd4706328bc1e66a5d60eade8e2e688b04c OP_EQUALVERIFY OP_CHECKSIG",
"address":"1FBbjzuX3xiWZZgMmApdS7xZsGYy8RFZP9"
},{
"value":"8.99",
"n":"1",
"scriptPubKey":"OP_DUP OP_HASH160 4f537d20b30cd892c48ce574a746adbc757efcdd OP_EQUALVERIFY OP_CHECKSIG",
"address":"18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe"
}],
"time":"2015-08-17 19:16:00",
"block":"00000000000001291109e7c399cc3b229a65ebe8d5caa7d9da70712dbe9fa194",
"blocknumber":"75424"
},"a6701ff7a5cfd97ff55730326ec281e0ad842b457b9c66b9c9e9cba9c8b0d724":{"hash":"a6701ff7a5cfd97ff55730326ec281e0ad842b457b9c66b9c9e9cba9c8b0d724","ver":"1","in":{"prev_out":{"hash":"275e9532c3a820fa790d553ff9fe21bf12f1dceacf2f751a8e6f6fa2b10fbec3","n":"2"},"address":"1JKZ7QPscvdjwvkcAeN9aBxw1Jk3zvuz9k"},"out":{"value":"0.9796","n":"0","scriptPubKey":"OP_DUP OP_HASH160 150994b6688043aa707f35db752d34faed831f63 OP_EQUALVERIFY OP_CHECKSIG","address":"12vEfirXhAkgJWMq14aBsHpJD39FGztb2i"},"time":"2015-08-17 19:07:27","block":"0000000000000447278208af6264a8e86c19d57fed47d85a3a01c4b7030e2643","blocknumber":"75423"}}}}}
如果我直接从浏览器执行URL:
https://xgcwallet.org/ex/GetWebTransactions/18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe
它会给我结果如下:
{"75c5731a04b825c46e9642bc12685db8dc7c4c367e022ac6ba95ee166024873e":{
"hash":"75c5731a04b825c46e9642bc12685db8dc7c4c367e022ac6ba95ee166024873e","ver":1,"in":[{"prev_out":{"hash":"27e841f82d44f82bdc1a2e6de162f3b133aa9db1372ce02f86f057a46555e35e","n":0},"address":"18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe"}],"out":[{"value":"1","n":0,"scriptPubKey":"OP_DUP OP_HASH160 9b92ebd4706328bc1e66a5d60eade8e2e688b04c OP_EQUALVERIFY OP_CHECKSIG","address":"1FBbjzuX3xiWZZgMmApdS7xZsGYy8RFZP9"},{"value":"8.99","n":1,"scriptPubKey":"OP_DUP OP_HASH160 4f537d20b30cd892c48ce574a746adbc757efcdd OP_EQUALVERIFY OP_CHECKSIG","address":"18ESQ4HuHJPDc18iRUQRXpscV2oh8bn1fe"}],"time":"2015-08-17 19:16:00","block":"00000000000001291109e7c399cc3b229a65ebe8d5caa7d9da70712dbe9fa194","blocknumber":75424},"a6701ff7a5cfd97ff55730326ec281e0ad842b457b9c66b9c9e9cba9c8b0d724":{"hash":"a6701ff7a5cfd97ff55730326ec281e0ad842b457b9c66b9c9e9cba9c8b0d724","ver":1,"in":[{"prev_out":{"hash":"275e9532c3a820fa790d553ff9fe21bf12f1dceacf2f751a8e6f6fa2b10fbec3","n":2},"address":"1JKZ7QPscvdjwvkcAeN9aBxw1Jk3zvuz9k"}],"out":[{"value":"0.9796","n":0,"scriptPubKey":"OP_DUP OP_HASH160 150994b6688043aa707f35db752d34faed831f63 OP_EQUALVERIFY OP_CHECKSIG","address":"12vEfirXhAkgJWMq14aBsHpJD39FGztb2i"}],"time":"2015-08-17 19:07:27","block":"0000000000000447278208af6264a8e86c19d57fed47d85a3a01c4b7030e2643","blocknumber":75423}}
如果您发现雅虎已将第一个字符转换为“ _ ”下划线,则会返回结果。
在此示例中{“ _ 5c5731a04b825c ...........
为什么会在此查询中执行此操作?
有谁能解释一下,我做错了什么?
答案 0 :(得分:0)
返回的JSON的第一个字符绝不应该是数字。如果它是一个数字,则它不是有效的JSON,因此它被转换为“_”。在我的例子中,第一个字符是“7”并被转换为“_”。
请更正JSON。 Yahoo API将完美无缺。