Last Updated: February 25, 2016
·
354
· meerkatdev

Json commas position

Lately I found that this way of structure Json fields:

var foo = {
  "string 1"
, "string 2"
, 3
}

is really much more comfortable than the classic one:

var foo = {
  "string 1",
  "string 2",
  3
}

where you are more likely to forget to deal with commas.
In the first case, it is less error prone because you are lees likely to cancel the first field than the last. Also the way it looks is improved! Of course, there will be who will prefer the second approach to the first, but is always subjective. I started to appreciate the first!