arduino-coinmarketcap-api icon indicating copy to clipboard operation
arduino-coinmarketcap-api copied to clipboard

Using deprecated json libraries

Open tooraj-enayati opened this issue 4 years ago • 4 comments

This need to be updated to use ArduinoJson 5

..\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:70:11: error: DynamicJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

DynamicJsonBuffer jsonBuffer;

       ^

tooraj-enayati avatar Jun 06 '20 13:06 tooraj-enayati

Replace

DynamicJsonBuffer jsonBuffer;
JsonArray& root = jsonBuffer.parseArray(response);

with:

 DynamicJsonDocument root(1024);
 DeserializationError error = deserializeJson(root, response);

and on error:

if(error){
    responseObject.error = error.c_str();
} // else is success

tom71 avatar Jun 09 '20 09:06 tom71

That will allow you to compile; however, the library is still obsolete until it is updated to use coinmarketcap pro/basic plan. Meaning, you have to create an account and use an API key, and update the code. Resolution is really to use an open exchange like binance to stream prices.

Michail1 avatar Jul 25 '20 06:07 Michail1

Would it be possible to link me to a code in order to do this? I'm no programmer, I can just follow step by step instructions. I'd really like to get my ticker working, but dont understand what needs to be done in order to do it with something other than coinmarketcap.......has anyone updated the code working?

qwiktune avatar Feb 07 '21 13:02 qwiktune

The code has not been updated except that of Json to version 6. What ticker do you have? If AFKdata, you could update to their code for free. There is also the rollercoaster code which is freeware. Also, M5 stacker which is free as well.

Basically, it depends on the ticker you have.

Michail www.VoltageGoat.com

Michail1 avatar Feb 07 '21 20:02 Michail1