I have very custom task and I need to make sure what are limits of each technology. I haven't found nothing similair in this forum yet. I am using Oraclize to get response from this url:


and I get such response:

{"Response":"Success","Type":100,"Aggregated":true,"Data":[{"time":1536559200,"close":197.88,"high":197.99,"low":196.45,"open":197.71,"volumefrom":948.44,"volumeto":186888.76},{"time":1536561000,"close":199.19,"high":199.35,"low":196.68,"open":197.88,"volumefrom":448.02,"volumeto":88870.37}], "TimeTo":1536562560,"TimeFrom":1536559200,"FirstValueInArray":true,"ConversionType":{"type":"force_direct","conversionSymbol":""}}

What I need to get is "open" price of first array element from Data which is 197.71 in this example and "close" price of second array element which is 199.19;

However, when I use my code, all I get is [] empty array or empty string. Here is the code:

function updatePriceSingle(uint256 timeStamp) payable {
   if (oraclize_getPrice("URL") > this.balance) {
       emit LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
   } else {
       emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
       oraclize_query(timeStamp, "URL", "json(https://min-api.cryptocompare.com/data/histominute?fsym=ETH&tsym=USD&limit=1&aggregate=30e=CCCAGG).Data",200000);


and here is callback:

function __callback(bytes32 myid, string result) {
  if (msg.sender != oraclize_cbAddress()) revert();
  emit LogPriceUpdated(result);

I know workaround to make 2 calls json(...).Data[0] and json(...).Data[1], but I want to save gas and get results from 1 call in such case above. Is it possible ? Maybe there are solutions using "Test query" in http://app.oraclize.it/home/test_query . Thank you in advance.

1 Answer 1


The reason you are getting an empty result, is that the URL has some incorrect parameters, which the API complains about, à la:

{"Response":"Error","Message":"aggregate param is not an integer.","Type":1,"Aggregated":false,"Data":[]}

I didn't read the API docs, so for the sake of quickness, just removed the aggregate part being complained about. I was able to achieve parsing of the open/close keys from the response using the following:


You can refer to JSONPath docs/testers for more info on achieving this, Oraclize is using a specific standards version referenced in their documentation.

Here's a link to the test_query page with the above: http://app.oraclize.it/home/test_query#VVJMKEdFVCk=:anNvbihodHRwczovL21pbi1hcGkuY3J5cHRvY29tcGFyZS5jb20vZGF0YS9oaXN0b21pbnV0ZT9mc3ltPUVUSCZ0c3ltPVVTRCZsaW1pdD0xKS5EYXRhWzpdW29wZW4sY2xvc2Vd

For more complex parsing, you can also use the computation datasource, which can additionally process various result, potentially saving computation costs on-chain.

  • 1
    this is the answer I've been looking for! Commented Sep 13, 2018 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.