Large number into variable Probably something easy but I’ve not resolved it. 

I’m extracting data from a JSON string and all the values are correct accept for two. 

They are referring to two date time values and are in milliseconds. 

One is the date refreshed and the other is date updated. 

Problem is they are both very large and I’m having difficulty assigning them in the IDE. 

One is 1588447162117 which is showing as 020-05-02 20:19:53.948  on the dashboard using the JSON.

Here is the code I have thus far to get the data from JSON:

#include &lt;ArduinoJson.h&gt;

void setup() {
  Serial.begin(4800);

  const char* input = "{TotalCases:3308678,TotalCasesToday:4458,TotalDeaths:234123,TotalDeathsToday:293,TotalRecovered:1042991,TotalTerritories:124,CurrentUpdatedMS:1588312648603,CurrentChangedMS:1588312648603}";

  StaticJsonDocument&lt;512&gt; doc;

  DeserializationError err = deserializeJson(doc, input);

  if (err) {
    Serial.print("Error: ");
    Serial.println(err.c_str());
    return;
  }

  unsigned long TotalCases = doc["TotalCases"];
  unsigned long TotalCasesToday = doc["TotalCasesToday"];
  unsigned long TotalDeaths = doc["TotalDeaths"];
  unsigned long TotalDeathsToday = doc["TotalDeathsToday"];
  unsigned long TotalRecovered = doc["TotalRecovered"];
  unsigned long TotalTerritories = doc["TotalTerritories"];
  unsigned long CurrentUpdatedMS = doc["CurrentUpdatedMS"];
  unsigned long CurrentChangedMS = doc["CurrentChangedMS"];

  Serial.print("Total Cases: ");
  Serial.println(TotalCases);
  Serial.print("Total Cases Today: ");
  Serial.println(TotalCasesToday);
  Serial.print("Total Deaths: ");
  Serial.println(TotalDeaths);
  Serial.print("Total Deaths Today: ");
  Serial.println(TotalDeathsToday);
  Serial.print("Total Recovered: ");
  Serial.println(TotalRecovered);
  Serial.print("Total Territories: ");
  Serial.println(TotalTerritories);
  Serial.print("Update time in ms:");
  Serial.println(CurrentUpdatedMS);
  Serial.print("Change time in ms:");
  Serial.print(CurrentChangedMS);
}

void loop()
{

}

**Serial monitor output**

Total Cases: 3308678
Total Cases Today: 4458
Total Deaths: 234123
Total Deaths Today: 293
Total Recovered: 1042991
Total Territories: 124
Update time in ms:0
Change time in ms:0


Should be good to manipulate it once I can work with it in a variable. 

Thanks for any input,

Shane
I didn't try myself, but just by looking at the docs I suggest you try:


Adding


#define ARDUINOJSON_USE_LONG_LONG 1


at the top of the sketch, before including ArduinoJson.h.


Declare CurrentUpdatedMS and CurrentUpdatedMS as either
unsigned long long or uint64_t.


Edit: To answer the question in the comment:


  When you said you looked at the docs where did you check?


I had to follow a (not so simple) path: Deserialization tutorial →
JsonDocument::operator[] → JsonVariant →
JsonVariant::as&lt;T&gt;(). This last page states that the method
as&lt;unsigned long long&gt;() “may require ARDUINOJSON_USE_LONG_LONG”.
Unfortunately, the macro is not linked, so I have to search for it and
found ARDUINOJSON_USE_LONG_LONG.