Can the -i option of dynamic inventory accept a json directly instead of a executable file ?

Hi,

no unfortunatelyou cannot pass any variable to the dynamic inventory, it will be called automatically by ansible with the host or list argument.
The only way you have is either setting env variables or having a config file.