SERVER-11715 fix Array.tojson ugly output

old
```js
{ "_id" : ObjectId("528bb1a22e8ce6252e109b25"), "a" : [  1 ] }
{ "_id" : ObjectId("528bb2de403954a7b8e464bd"), "a" : [  1,  2,  3 ] }
{ "_id" : ObjectId("5295136221abf7a8aa78d91d"), "b" : [  123,  "awesome" ] }
{ "_id" : ObjectId("52951abf6e835ae2f8401ecb"), "nums" : [  1,  [  2,  [  3 ] ] ] }
{ "_id" : ObjectId("52952c86a8de752dc565fd38"), "nums" : [ ], "dogs" : [  123 ] }
```

new
```js
{ "_id" : ObjectId("528bb1a22e8ce6252e109b25"), "a" : [ 1 ] }
{ "_id" : ObjectId("528bb2de403954a7b8e464bd"), "a" : [ 1, 2, 3 ] }
{ "_id" : ObjectId("5295136221abf7a8aa78d91d"), "b" : [ 123, "awesome" ] }
{ "_id" : ObjectId("52951abf6e835ae2f8401ecb"), "nums" : [ 1, [ 2, [ 3 ] ] ] }
{ "_id" : ObjectId("52952c86a8de752dc565fd38"), "nums" : [ ], "dogs" : [ 123 ] }
```

I also made the function less difficult to understand.

https://jira.mongodb.org/browse/SERVER-11715