refactored json loading and parsing