Generate less garbage in serialization.  #3127.

Usage of #compact means that we generate two arrays: one as the input,
one as the output.

Using a GET request that aliases POST /api/v1/fieldwork for the dates
[2013-01-22, 2013-01-29] on training-ncsapps, we get this out of
perftools' cputime measurement:

  Total: 2080 samples
     717  34.5%  34.5%      717  34.5% garbage_collector
     176   8.5%  42.9%      190   9.1% Enumerable#any?
      73   3.5%  46.4%     1294  62.2% ActiveSupport::JSON::Encoding::Encoder#check_for_circular_references
      69   3.3%  49.8%     1313  63.1% Hash#each
      49   2.4%  52.1%       99   4.8% ActiveSupport::JSON::Encoding::Encoder#options_for

(sampling rate is around 100 samples/sec; therefore 1 sample =~ 10 ms)

The behavior is very consistent across a small number of runs.  For the
below data, one run was done to warm up the application worker, and then
five more runs were done in succession.  The first run is not included
in the below statistics:

  mean total samples: 2082 samples (stdev: 1.154)
  mean samples in GC: 723 samples (stdev: 2.65)

After this patch: