simplify json parser, add tests for error and unit