FiddlerScript是能够解析和修改JSON。例如,OnBeforeResponse中的以下附加内容将偷偷地将艾普林氏病返回的外部IP地址替换为127.0.0.1
if (oSession.url == "api.ipify.org/?format=json"){
var j = GetResponseJson(oSession);
j["ip"] = "127.0.0.1";
SetResponseJson(oSession, j);
}其中,GetResponseJson和SetResponseJson是我从Eric的链接答案中生成的帮助函数:
static function GetResponseJson(oSession: Session){
return Fiddler.WebFormats.JSON.JsonDecode(oSession.GetResponseBodyAsString()).JSONObject;
}
static function SetResponseJson(oSession: Session, j){
oSession.utilSetResponseBody(Fiddler.WebFormats.JSON.JsonEncode(j));
}这对于修改Fiddler截获的JSON有效负载非常有用。
我的问题是:
发布于 2015-12-02 06:19:13
FiddlerScript使用JScript.NET,因此可以引用包含XmlDocument类的.NET程序集,包括System.Xml。
首先,在Fiddler > Tools > Fiddler选项>扩展中,添加对System.Xml.dll的引用

接下来,在FiddlerScript顶部引用它:
import System.Xml;此时,您可以创建XmlDocument对象:
var x = new XmlDocument();发布于 2016-01-31 15:17:04
若要在响应中从XML中的节点添加自定义列,需要使用FiddlerScript。
在加载System.xml引用时,在FiddlerScript (规则>自定义规则)中,您可以添加:
public static BindUIColumn("Request")
function testXmlColumn(oSession: Session){
if (oSession.oResponse != null && oSession.oResponse["Content-Type"] == "text/xml; charset=utf-8") {
var doc = new XmlDocument();
doc.LoadXml(oSession.GetResponseBodyAsString());
var xPathString = '/an/XPath/Expression';
var xmlNode = doc.DocumentElement.SelectSingleNode(xPathString);
return xmlNode.InnerText;
}
return "";
}显然,您需要用一个/an/XPath/Expression表达式替换XPath。这是相当简单的语言来匹配一个节点。
https://stackoverflow.com/questions/34012916
复制相似问题