updated json parser to handle encoding issues