improved JSONwriter