var data = JSON.parse(value),
	interfaces = [];

function getField(data, path, default_value) {
	var steps = path.split('.');
	var step = steps.shift();

	while (typeof step !== 'undefined') {
		if (typeof data === undefined || typeof data[step] === 'undefined') {
			return default_value;
		}

		data = data[step];
		step = steps.shift();
	}
	return data;
};

data.forEach(function (iface) {
	interfaces.push({
		'{#IFNAME}': getField(iface, 'name'),
		'{#IFDESCR}': getField(iface, 'description', ''),
		'{#LINKLEVELTYPE}': getField(iface, 'link-level-type', ''),
		'{#IFTYPE}': getField(iface, 'if-type', ''),
		'{#LINKTYPE}': getField(iface, 'link-type', ''),
		'{#IFADMINSTATUS}': getField(iface, 'admin-status.#text'),
		'{#IFOPERSTATUS}': getField(iface, 'oper-status'),
		'{#IFSPEED}': getField(iface, 'speed')
	});

});

return JSON.stringify(interfaces);