Moved some ra/json code from encodeAnalysis to analysis, since it is common to both the pipeline and galaxy methods.