function (json, variables, memberMode, callback) {
		if (typeof memberMode == 'function') {
			callback = memberMode;
			var member_mode = memberMode || false;
		} else {
			var member_mode = memberMode || false;
		}
			
		var str = JSON.stringify(json);
		var output = str.replace(/{{\w+}}/g, function(found) {
			found = (member_mode) ? found.match(/[\w\.]+/)[0] : found;
			
			// Traverse object
			var f;
			traverse(variables).forEach(function (v) {
				if (v && typeof v[found] != 'undefined') {
					if (typeof v[found] != 'string') {
						// Stringify if not string yet
						f = JSON.stringify(v[found]);
					} else {
						f = v[found] || found;
					}
				}
			});
			return f;
		});
		
		// Array must have the first and last " stripped
		// otherwise the JSON object won't be valid on parse
		output = output.replace(/"\[(.*)\]"/, '[$1]');
	
		callback(JSON.parse(output));
	}
function (json, variables, memberMode, callback) {
		if (typeof memberMode == 'function') {
			callback = memberMode;
			var member_mode = memberMode || false;
		} else {
			var member_mode = memberMode || false;
		}
			
		var str = JSON.stringify(json);
		var output = str.replace(/{{\w+}}/g, function(found) {
			found = (member_mode) ? found.match(/[\w\.]+/)[0] : found;
			
			
			var f;
			traverse(variables).forEach(function (v) {
				if (v && typeof v[found] != 'undefined') {
					if (typeof v[found] != 'string') {
						
						f = JSON.stringify(v[found]);
					} else {
						f = v[found] || found;
					}
				}
			});
			return f;
		});
		
		
		
		output = output.replace(/"\[(.*)\]"/, '[$1]');
	
		callback(JSON.parse(output));
	}
function ( json , variables , memberMode , callback ) { if ( typeof memberMode == 'function' ) { callback = memberMode ; var member_mode = memberMode || false ; } else { var member_mode = memberMode || false ; } var str = JSON . stringify ( json ) ; var output = str . replace ( / {{\w+}} / g , function ( found ) { found = ( member_mode ) ? found . match ( / [\w\.]+ / ) [ 0 ] : found ; // Traverse object var f ; traverse ( variables ) . forEach ( function ( v ) { if ( v && typeof v [ found ] != 'undefined' ) { if ( typeof v [ found ] != 'string' ) { // Stringify if not string yet f = JSON . stringify ( v [ found ] ) ; } else { f = v [ found ] || found ; } } } ) ; return f ; } ) ; // Array must have the first and last " stripped // otherwise the JSON object won't be valid on parse output = output . replace ( / "\[(.*)\]" / , '[$1]' ) ; callback ( JSON . parse ( output ) ) ; }
Replace Placeholders in any JSON
Member mode allow to replace object member
without using the {{}} of left part of the variables
@param json {Object}
@param variables {Object}
@param memberMode {Boolean}
@param callback {Function}
Replace Placeholders in any JSON Member mode allow to replace object member without using the {{ }} of left part of the variables