Index: /branches/rel_ag_9_4_5/webui/proxy/new/inc/class.anLib_cli.php
===================================================================
--- /branches/rel_ag_9_4_5/webui/proxy/new/inc/class.anLib_cli.php	(revision 20405)
+++ /branches/rel_ag_9_4_5/webui/proxy/new/inc/class.anLib_cli.php	(working copy)
@@ -411,16 +411,50 @@
 
 		// Handle the output
 		$output = trim($output);
-		$json = json_decode($output);
-		if (!$json) {
-		    //error parsing json - this must be a bug
-		    echo "Fatal error executing command: $cmd_str; The abnormal response is \"$output\"\n";
-		    exit(1);
-		}
+		$json = self::check_multiple_json_format($cmd_str, $output);
 		return $json;
 	}
 	/*************************************************************************
 	 *
+	 * Check json format if there are multiple json strings
+	 * and return decoded last json string from CLI command
+	 *
+	 * @param string	CLI command
+	 * @param string	response from CLI command
+	 *
+	 * @return object decode the last json string and return
+	 *
+	 *************************************************************************/
+	function check_multiple_json_format($cmd_str, $output)
+	{
+		$jsons = array();
+		$buffer = '';
+		$depth = 0;
+		for ($i = 0, $len = strlen($output); $i < $len; $i++) {
+			$char = $output[$i];
+			$buffer .= $char;
+
+			if ($char === '{') {
+				$depth++;
+			} elseif ($char === '}') {
+				$depth--;
+				if ($depth === 0) {
+					$jsons[] = $buffer;
+					$buffer = '';
+				}
+			}
+		}
+		foreach ($jsons as $json) {
+			if (!json_decode($json)) {
+				//error parsing json - this must be a bug
+				echo "Fatal error executing command: $cmd_str; The abnormal response is \"$output\"\n";
+				exit(1);
+			}
+		}
+		return json_decode(end($jsons));
+	}
+	/*************************************************************************
+	 *
 	 * Execute a CLI command from backend directly
 	 * and return any resulting output
 	 *
