Moved json error handling to base repository