when output JSON use write instead of writeln