I have a python script which formats the json file and create a new file in another location. My splunk instance reads this new formatted file.
Is there any way we can use Splunk to take the not formatted file, run script on it and upload the same?
Kinda sorta... You can run your script as a scripted input and then monitor the location you're dropping the modified file in. See scripted inputs in inputs.conf documentation. Then see monitor in the same document.