I think it must be something in STRING_TO_JSONVALUE function.
If JSONVAR.HMIVarAsString is correct, that means the value is correct when JSONVAR.AsString is set. Because all it's doing there is copying the value, since it's already a string. I was using that for a certain HMI that couldn't accept properties, only variables.
So, you might want to set a breakpoint in JSONVAR.AsString.Set, and then step through STRING_TO_JSONVAR to see where the limiting is happening.
It might be useful to take out the {attribute 'hide'} from the InternalValue variable, so you can look at the actual bytes stored internally
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
if you set a breakpoint here, you should be able to step through each name:value pair, and see what's contained in the NameValue array at the one that's not working.
The NameValue array is populated in the .Value method, which we've already modified, line 65-70.
Excellent, glad to hear it. If you're interested in contributing to the library you can contact me directly, my email address is scattered all over the documentation. Some time in the future when I have some time I'd like to figure out how to allow for both STRING and WSTRING types in the same library. Not sure how I'm going to do that yet without creating two entirely separate systems.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In new function WSTRING_TO_JSONVALUE I have like you wrote. In property
JSONVAR_16.CharString:
{attribute 'monitoring':='call'}PROPERTY CharString : WSTRING(GPL_JSON_16.MAX_VALUE_SIZE)
JSONVAR_16.CharString.Get:
JSONVAR_16.CharString.Set:
Last edit: damian177 2022-01-28
Size should be doubled
I think like this:
_Size:= INT_TO_UINT(WLEN(CharString)) * 2;
Effect is like in attachement. Last special characters in "description" variable are bad decode ...
Last edit: damian177 2022-01-28
OK, what about leaving Size the way it was, and changing:
I can't remember how Size is used elsewhere - it's probably something to do with whether it includes the trailing null character or not.
udiCount:= (_Size+1) * 2
this line does not affect the result at all
Last edit: damian177 2022-01-28
Did you change it in CharString.Get as well?
sorry my fault, now it works.
but still cuts characters. For example I put WSTRING:
ΕΕΔΓ³ΕuΔ QΓ³ΕΕΕΕNΕ
but after Parase in JSON variable is :
"ΕΕΔΓ³ΕuΔ QΓ³["
what can still limit the length of the variable?
Last edit: damian177 2022-01-28
I think it must be something in STRING_TO_JSONVALUE function.
If JSONVAR.HMIVarAsString is correct, that means the value is correct when JSONVAR.AsString is set. Because all it's doing there is copying the value, since it's already a string. I was using that for a certain HMI that couldn't accept properties, only variables.
So, you might want to set a breakpoint in JSONVAR.AsString.Set, and then step through STRING_TO_JSONVAR to see where the limiting is happening.
It might be useful to take out the {attribute 'hide'} from the InternalValue variable, so you can look at the actual bytes stored internally
Both HMIVarAsString and AsString have truncated characters.
In that case, the value is set in JSON_TO_STRUCT, line 110
if you set a breakpoint here, you should be able to step through each name:value pair, and see what's contained in the NameValue array at the one that's not working.
The NameValue array is populated in the .Value method, which we've already modified, line 65-70.
Maybe something wrong with the size math?
It works!
I forgot set my global variable GPL_JSON_16 in edited above line. Now it works.
Excellent, glad to hear it. If you're interested in contributing to the library you can contact me directly, my email address is scattered all over the documentation. Some time in the future when I have some time I'd like to figure out how to allow for both STRING and WSTRING types in the same library. Not sure how I'm going to do that yet without creating two entirely separate systems.