Extracted json parsing to a class