I have inherited a number of javascript files containing a mixture of JSON objects and other js declarations (functions, variables). I'm writing a python script to move the data contained in the JSON objects into another system.
I'd like to avoid duplicating any sort of parser functionality in what is essentially a throw away script and avoid combing through the files by hand.
Is there a nice (pythonic) solution to filter out the JSON in these files and pass it to json.loads() ?