It's worth noting, "pretty printing" could be configured entirely in an OutputRange which watches for certain syntax coming into the range and inserts whitespace where it believes to be appropriate, so writeJSON functions would not need to know anything about pretty printing.