Hi Bruce,
I - think - I've spotted a tricky error in the parsing of the json.
Whenever a literal (null, true, false) or numeric gets processed as the last element of an array IN HUMAN READABLE form there is a linebreak (<13,10>) right after this value (before the close "}" of the record structure is processed added to these literals or numbers.
Below I've pasted an example that shows this misbehaviour. the array "orderLines" contains three elements and all "ending" fields ("qAcceleratedType", "label1", "label1") have values that are directly followed by a linebreak. When you modify the "HandleChar" method of the JSONCLASS to include the trace like below you see what's going on quite easily:
JSONClass.HandleChar PROCEDURE(STRING pChar)
CODE
if SELF.Stack.StringStarted OR SELF.Stack.NumericStarted OR SELF.Stack.BooleanStarted OR SELF.Stack.NullStarted
IF not SELF.Stack.Buffer &= NULL
SELF.Stack.Buffer.Append(pChar)
self.trace('pChar : ' & pChar & ' val(pChar) : ' & val(pChar))
end
end
I think the solution is maybe to add the following to the loadstring method to only add linebreak when within string values:
of '<10>' orof '<13>'
if SELF.Stack.StringStarted
SELF.HandleChar(pToParse[c])
end!if
This is the json
{
"orders_response": {
"apiVersion": "1.0",
"orderLines": [
{
"fkSetLineId": 12056305,
"qAcceleratedType": 30
}
{
"fkSetLineId": 12056307,
"qAcceleratedType": 30,
"label1": true
}
{
"fkSetLineId": 12056307,
"qAcceleratedType": 30,
"label1": null
}
]
}
}