thoughtworks/contracts — pull request #5 by jesusmercado (2013-06-08 03:44:46+00:00)
Title: Use yajl json parser

Use yajl json parser instead of the stdlib JSON parser.
The reason is because yajl shows nicer messages when deals with invalid
JSON inputs.

As Linus would say: “Talk is cheap. Show me the code.” here is an
example:
```
$ irb
irb(main):001:0> require 'json'
=> true
irb(main):002:0> JSON.parse('{"name": "contracts" "license": "MIT"}')
JSON::ParserError: 743: unexpected token at '{"name": "contracts"
"license": "MIT"}'
.
.
.

irb(main):003:0> require 'yajl/json_gem'
=> true
irb(main):004:0> JSON.parse('{"name": "contracts" "license": "MIT"}')
JSON::ParserError: parse error: after key and value, inside map, I
expect ',' or '}'
{"name": "contracts" "license": "MIT"}
(right here) ------^
.
.
.
```
As you can see yajl shows parsing errors in a nicer way.