If your code outputs JSON, use the ```rspec:json
formatter to prettify your JSON output. Note that your code must produce a raw JSON string in order to use this formatter, it does not convert Ruby objects into JSON.
```rspec:json
subject(:json) do
{
'key' => 'value',
'array' => [1, 2, 3],
'boolean' => true,
'otherBoolean' => false
}.to_json
end
it 'has expected key/value' do
expect(JSON.parse(json)).to include({ 'key' => 'value' })
end
```