We are pleased to present below all posts archived in 'April 2015'. If you still can't find what you are looking for, try using the search box.
The following is most of the code for the JSON Parser state machine function.
Read the rest of entry »
Increments (the enum) the state.
// For many states when its parse requierment is satified: state <-- state++ void IncrementState() { parseState = (Expecting)((int)parseState + 1); }
If in a state of “readiness” checks if the current character is the expected one. If so increment or change the state.
// For states where state increments by one if the expected character is the // current one in the stream. BOOL Expect(char c) { char ExpectArray[11] = ""; //X is don't care if (c == ExpectArray[parseState]) { IncrementState(); return true; } //A 'fix' to facilitate parsing of JSON strings that aren't arrays: else if (('{' == c) && (startOfArray == parseState)) { //Permit parsing of records only parseState = startOfName; } else { //Expectation wasn't satified so error output.print(F("Expected: ")); output.println(ExpectArray[parseState]); output.print(F("Got: ")); output.println(c); parseState = error; output.print(F("Expect Next Err: ")); output.println(parseState); ErrNo = 10; return false; } return true; }
The Parser Function is a giant Switch-Case statement.
//The current state of the State Machine Expecting parseState = startOfArray; /* Parses a JSon array of records of name value pairs */ BOOL ParseJsonString(char c) { switch (parseState) { case startOfArray: result = Expect(c); if (result) { //Start of array so no records yet. RecordNo = 0; output.println(F("\r\n1: Starting parse of array.")); } ... ... ... }
// Parser state machine states: enum Expecting { startOfArray, startOfRecord, startOfName, gettingName, nameValueSeparator, startOfValue, gettingValue, gettingEndOfValueORRecord, gotEndOfRecord, gettingRecordSeparator, done, error, gettingString, gettingBoolean, gettingInteger, gettingFloat, gettingNull }
A detailed description of the CEJSON JSON Parser.
On March 2 the pending merger of NXP Semiconductors N.V. and Freescale Semiconductor, Ltd was announced.
Version 1 AzMS Tables use an auto-incremented integer field as the primary key which is more compact than the GUID string used in version 2 AzMS tables.. The Azure Portal generates Version 2 tables which can be inefficient for resource limited embedded devices. This blog covers how to generate version 1 AzMS tables.
When an HTML POST/GET/PATCH/DELETE message is posted to an Azure Mobile Service Table, the message can be intercepted and modified. Also the response can also be intercepted and modified. This blog outlines how to do this.
C:\GIT\CEJSON\JSONParser.Desktop\Debug>JSONParser DELETE 24