A recursive function that parses a JSON object