This project is read-only.

JSON Parser error

Jan 15, 2012 at 10:51 PM

Hello, I have attempted to use the JSONParser in a project and I am able to do the following:

1) build and deploy to a Netduino Plus controller

2) Instantiate and partially process a http request

But part of the way through I am getting a strange error in the JSONParser class:

An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll

This occurs on line 266 of the JSONParser.cs


        protected void StoreCurrentDataStructure() {
            var innerStructure = (JSONObject)_dataStructureStack.Pop();
            _currentDataStructure = (JSONObject)_dataStructureStack.Peek();
the field _dataStructureStack has a count of 0, which I am guessing is the reason for the exception, but why wouldn't there be any items in this stack?
The JSON string is:

"{\"route\":\"onthephone\", \"alert_status\":\"on\"}"

I had to remove the netduino.helpers.Helpers classes and create my own project from the main project because it was throwing the  "An error has occurred: please check your hardware" reminiscent of the files being too large for the netduino. Outside of this I am using all of the original source code.

Thanks in advance


Jan 16, 2012 at 2:12 AM

Hi John,

I am aware of the JSON Parser issue: the latest checked in code is currently broken. I am in the process of refactoring it and the new code is not complete. Please use the JSON Parser code dating back to September / October last year for a version that works but won't support complex data structures.

About the size of the library: the library is getting larger so you need to take out the things you don't need in your project or create a new project library only including the subset of the netduino helper library files that you want. Either way will result in a library with a small footprint.

I hope this helps.



Jan 13, 2013 at 6:11 AM

See our latest discussion thread for a (temporary?) work-around for this issue.