function getField(data, path) {
	var steps = path.split('.');
	for (var i = 0; i < steps.length; i++) {
		var step = steps[i];
		if (typeof data !== 'object' || typeof data[step] === 'undefined') {
			throw 'Required field was not found: ' + path;
		}

		data = data[step];
	}

	return data;
}

var data = JSON.parse(value),
	mem_total = getField(data,'ocs.data.nextcloud.system.mem_total'),
	mem_free = getField(data,'ocs.data.nextcloud.system.mem_free');

return Math.ceil(100 - mem_free / mem_total * 100);