Fixing the issues with generating the JSON