Hello, Arnaud--
The returned object has a JSONObject property which is an ArrayList, Hashtable, or primitive value that is equivalent to the json object in question. Fiddler uses this class in its JSONView extension.
If you prefer a different pattern (e.g. something with strong typing, a schema, etc) then you can & should use one of the myriad JSON encoder/decoders available for the .NET Framework.
Regards,
Eric Lawrence
Telerik
Check out the
Telerik Platform
- the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thanks for your quick answer. My wrong was to miss JSONObject and its meaning.
I post my test case (in FiddlerScript) in case someone has the same question:
var
sInput =
'{"a" : 1, "b" : [2, 3, 4]}'
;
var
oJSON = Fiddler.WebFormats.JSON.JsonDecode(sInput);
FiddlerApplication.Log.LogFormat(
'input: {0}'
, sInput);
FiddlerApplication.Log.LogFormat(
'oJSON: {0}'
, oJSON.ToString());
FiddlerApplication.Log.LogFormat(
'oJSON["a"]: {0} (expected: 1)'
, oJSON.JSONObject[
"a"
]);
FiddlerApplication.Log.LogFormat(
'oJSON["b"] : {0} (expected: 2)'
, oJSON.JSONObject[
"b"
][0]);
Hashtable ht = (Hashtable)json.JSONObject;
string value= ht["name"].ToString();
I am trying to parse a simple JSON using Fiddler Script.
var sInput = '{"a" : 1, "b" : [2, 3, 4]}';
var json = Fiddler.WebFormats.JSON.JsonDecode(sInput);
But from the intellisense json.JSONObject does not showup. If I type on my own it throws error. This may be very basic, but I am not able to get fwd. Please help.
Thanks