In CustomRules.js
static function OnBeforeResponse(oSession: Session) {
var responseStringOriginal = oSession.GetResponseBodyAsString();
var responseJSON = Fiddler.WebFormats.JSON.JsonDecode(responseStringOriginal);
var responseJSONObject = responseJSON.JSONObject;
}
There is an array in response responseJSONObject , which are like
[
{
"id": "6661370502453447944"
},
{
"id": "333"
},
...
]
Question 1: How can I get this array's length or traversal this array?
Question 2: How can I save the javascript array to the responseJSON.JSONObject?
I tried
var newJSON = Fiddler.WebFormats.JSON.JsonDecode('{}');
var newJSONObject = newJSON.JSONObject;
newJSONObject['type'] = 'aweme_info'; //ok
newJSONObject['aweme_length'] = 3; //ok
newJSONObject['k']['kell'] = 'good'; //failed
var tpArray = new Array();
for (var i = 1; i < 3; i++) {
tpArray.push(i);
}
var jsonString = JSON.stringify(tpArray); // failed
// how can I convert tpArray to JSON?
Question 3: Where can I find any documentation about this object "Fiddler.WebFormats.JSON", like what method and properties it have.
I tried several ways but nothing works and I can't using the JSON.parse() function in this script.
I also google for the documents of this object (Fiddler.WebFormats.JSON) and found nothing.
Thank you very much and welcome reply any infomation.