Fiddler's JsonDecode
function creates an object; it doesn't create the type of object you expect and even if it did, changing values in that object wouldn't have any automatic impact on the string making up the response body.
See http://www.telerik.com/forums/how-to-use-fiddler-webformats-json-jsondecode for some insight into how this object works.
You'd need to do something like bodyjson.JSONObject["Sales"]["Qty"]
to get the value. After you make any changes, you'd need to call JsonEncode
on the object to get a string and then set the response's body to that string.
var s = '{"Sales" : { "Qty" : 8, "Item" : { "value" : "7" }, "TaxCode" : { "value" : "NON" }, "UnitPrice" : 3 }, "LineNum" : 0, "DetailType" : "Sales", "Amount" : 3, "Id" : "1"}';
var j = Fiddler.WebFormats.JSON.JsonDecode(s);
MessageBox.Show(j.JSONObject["Sales"]["Qty"]);
j.JSONObject["Sales"]["Qty"] = 4;
MessageBox.Show(Fiddler.WebFormats.JSON.JsonEncode(j.JSONObject));
If you simply want to make a trivial change to the body text, don't bother turning the string into an object at all, simply change the string itself directly.