    # File lib/chef/knife/core/ui.rb, line 146
          def edit_data(data, parse_output=true)
            output = Chef::JSONCompat.to_json_pretty(data)

            if (!config[:no_editor])
              filename = "knife-edit-"
              0.upto(20) { filename += rand(9).to_s }
              filename << ".js"
              filename = File.join(Dir.tmpdir, filename)
              tf = File.open(filename, "w")
              tf.sync = true
              tf.puts output
              tf.close
              raise "Please set EDITOR environment variable" unless system("#{config[:editor]} #{tf.path}")
              tf = File.open(filename, "r")
              output = tf.gets(nil)
              tf.close
              File.unlink(filename)
            end

            parse_output ? Chef::JSONCompat.from_json(output) : output
          end