JSON indentation with environment support

Related to #612.

Docs will improved before merge.