Fixing bug in json generation - to_json method has to be defined with parameters