JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<input type='file' accept='text/plain' onchange='openFile(event)'>
<br>
<img id='output'>
<script>
var openFile = function(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function() {
var text = reader.result;
// console.log(reader.result.substring(0, 200));
// console.log(text);
var data = JSON.parse(text);
var features = data.features;
features.forEach(function(obj, index) {
obj.geometry.z = obj.attributes.Latitude + obj.attributes.Longtitude;
});
//console.log(data); // that's what you want?
exportData(JSON.stringify(data));
function exportData(data, name = 'filename.txt') {
var export_blob = new Blob([data]),
saveLink = document.createElement('a');
saveLink.href = window.URL.createObjectURL(export_blob);
saveLink.download = name;
saveLink.textContent = 'export';
document.body.appendChild(saveLink);
}
};
reader.readAsText(input.files[0]);
};
</script>