I have separated the JSON parsing and file creation in different classes and modified the MainActivity class to work with them