Extract json responses, clean up index.py