2
Vote

JsonParser issue

description

I'm trying to use JsonParser. It gives me an error on very basic test:
        JsonParser parser = new JsonParser();
        Hashtable data = parser.Parse("{ \"connected\": true, \"started\": \"2017-07-18T11:07:57.330Z\", \"scale\": 0, \"current\": 32, \"power\": 0, \"model\": \"\", \"temperature\": 0, \"completed\": \"2017-07-18T11:07:57.330Z\" }");
The error is in StoreCurrentDataStructure() method upon completion of the parse; it is caused by popping single item from the _dataStructureStack and then attempting to "peek" another, but the stack is empty at that moment, so it fails with "Stack empty.".

Any suggestion would be highly appreciated.

comments

bootron wrote Mar 21, 2015 at 9:27 PM

Same problem happening here. Using the following code:
string json = "{\"query\":{\"count\":1,\"created\":\"2015-03-21T07:33:57Z\",\"lang\":\"en-US\",\"results\":{\"channel\":{\"item\":{\"condition\":{\"code\":\"27\",\"date\":\"Fri, 20 Mar 2015 11:52 pm PDT\",\"temp\":\"53\",\"text\":\"Mostly Cloudy\"}}}}}}";

var parser = new JSONParser();
var result = parser.Parse(json);