Skip to content

Instantly share code, notes, and snippets.

@dstd
Created February 27, 2018 13:07
Show Gist options
  • Save dstd/39927fc79c065c8d6229070870a2ebe9 to your computer and use it in GitHub Desktop.
Save dstd/39927fc79c065c8d6229070870a2ebe9 to your computer and use it in GitHub Desktop.
[Fiddler] JSON response modification
// ...
static function OnBeforeResponse(oSession: Session) {
// ...
if (oSession.uriContains("/someMethod")) {
var json = Fiddler.WebFormats.JSON.JsonDecode(oSession.GetResponseBodyAsString()).JSONObject;
var p = json["field"]["subfield"]["subsubfield"];
p["field1"] = 0 != 1;
p["anotherfield2"] = 0 != 0;
p["yaf3"] = 0 != 1;
oSession.utilSetResponseBody(Fiddler.WebFormats.JSON.JsonEncode(json));
}
// ...
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment