Fiddler access nested json to modify

2 posts, 0 answers
  1. Denni
    Denni avatar
    2 posts
    Member since:
    Oct 2018

    Posted 03 Oct 2018 Link to this post

    i somehow can´t reach the objects in a nested json. I easily can reach the element test, but how to reach this_month inside "stats"? this is my json:

     

    {"test":"OK","stats":{"this_month":"1653","this_week":"1653"}}     
  2. Denni
    Denni avatar
    2 posts
    Member since:
    Oct 2018

    Posted 03 Oct 2018 in reply to Denni Link to this post

    sorry, accidentialy posted. here is my code:

    var oResponseBody = oSession.GetResponseBodyAsString();
           JSON.JSONParseResult oJSON = JSON.JsonDecode(oResponseBody) as JSON.JSONParseResult;
           Hashtable oObj = oJSON.JSONObject as Hashtable;
     
           oObj["stats"]["this_month"] = "changed";
     
     
     
     
            var modBytes = Fiddler.WebFormats.JSON.JsonEncode(oObj);
     
           // Convert json to bytes, storing the bytes in request body
           var mod = System.Text.Encoding.UTF8.GetBytes(modBytes);
           oSession.ResponseBody = mod;
Back to Top