Skip to content

Instantly share code, notes, and snippets.

@Samsy
Created July 17, 2016 15:01
Show Gist options
  • Save Samsy/1e728e06c81ccbe5455413f32366ccfe to your computer and use it in GitHub Desktop.
Save Samsy/1e728e06c81ccbe5455413f32366ccfe to your computer and use it in GitHub Desktop.
var fs = require('fs');
var path = require('path');
var http = require('http');
var request = require('request');
var distTree = ('./');
var file = ('chin.json');
var file = path.resolve(distTree, file);
var content = JSON.parse(fs.readFileSync(file, 'utf8'))
var arr = content.data.attributes.position.array
var arr2 = []
var i = 0
while( i < arr.length ) {
arr2[i] = Number(arr[i].toFixed(1))
i++
}
console.log(arr2)
content.data.attributes.position.array = arr2
fs.writeFile('chinopti.json', JSON.stringify(content, null), function(err) {
if(err) {
return console.log(err);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment