witnessmenow / arduino-coinmarketcap-api

A wrapper around the coinmarketcap.com api for Arduino (supports ESP8266)
37 stars 12 forks source link

Using deprecated json libraries #7

Open tooraj-enayati opened 4 years ago

tooraj-enayati commented 4 years ago

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;

       ^
tom71 commented 4 years ago

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
Michail1 commented 4 years ago

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.

qwiktune commented 3 years ago

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?

Michail1 commented 3 years ago

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