ArduinoJson comes with the four following macros:

#define ARDUINOJSON_VERSION "6.21.5"
#define ARDUINOJSON_VERSION_MAJOR 6
#define ARDUINOJSON_VERSION_MINOR 21
#define ARDUINOJSON_VERSION_REVISION 5

Here is how you can print ArduinoJson’s version:

Serial.print("Using ArduinoJson version ");
Serial.println(ARDUINOJSON_VERSION);  // 6.21.5

Here is how you can test that the expected version is installed:

#if ARDUINOJSON_VERSION_MAJOR!=6 || ARDUINOJSON_VERSION_MINOR<21
#error ArduinoJson 6.21+ is required
#endif

See also:

Global warming stripes by Professor Ed Hawkins (University of Reading)