how to convert an inventory file/directory into json format?

Hi all,
Is there a quick clean way to convert an inventory file/directory into json format which can then be fed in as a dynamic inventory (with some tweaks to the json)

Thanks,
Aneesh