Code refactoring thanks to JSON