Separate json processing to it's own function - preparation for unit
testing