How to know if running UI4 or UI5

Very simple question: how to know in a plugin if UI4 or UI5 is run ?

Use the version variables: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#variable:_version.2C_version_branch.2C_version_major.2C_version_minor
If the firmware is something like 1.1.xxxx then it’s UI4, if it’s like 1.5.xxx then it’s UI5.

Ok, thank you.

If I correclty understand, the json files are not compatible between UI4 and UI5. What would be the proper solution to have a plugin running for UI4 and UI5 as soon as the plugin requires json files ? Is it possible to choose it dynamically (through lines of code), rather than setting it statically in the D_xxx.xml file ?

You can have a Json file compatible with both UI4 and UI5. The best example to look at is one of the alarm panel plugins (e.g the DSC plugin).