extracted json parsing to a private method