SPARK-4228 SchemaRDD to JSON

Here's a simple fix for SchemaRDD to JSON.
Move it to the line above.

Also, can you make changes according to @marmbrus's comments on tests (round-trip our existing datasets with this code path)?