Replies: 1 comment 2 replies
-
Hey friends, I'm coming back with some more thoughts / questions / requests. It seems that JSON strings like that can't be handled because of memory problems?! Sadly, I cannot debug nicely; breakpoints are reached but I cannot see any values of most variables. May I missed some VS configuration to achieve this? using Memory = nanoFramework.Runtime.Native.GC; did not help. That's why I decided to change from ArrayList to a "string" because the array elements are at the end simply on/off flags. But here comes the next issue for me. I defined "pin_setup" as string in the JSON: "pin_setup":"10101010000000000000000000000000" but the deserialization seems trying to convert that string into int/uint (more than 10 chars gave me errors) which of course fails. But if I am right and the deserialization tries number conversion because the string contains only numbers, why is that? Temporarily I changed the flag values this way "x" = on, "o" = off => "xoxoxoxooooooooooooooooooooooooo" which is working and shifts my Sn74hc595 array nicely, but this is a little bit dirty, isn't it? Some helping feedback would be nice. Regards. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys,
it drives me crazy...
I have a JSON like this:
commandJson =
{
"pin_setup": [{
"pin": 1,
"set_on": true
}, {
"pin": 2,
"set_on": false
}, {
"pin": 3,
"set_on": true
}, {
"pin": 4,
"set_on": false
}, {
"pin": 5,
"set_on": true
}, {
"pin": 6,
"set_on": false
}, {
"pin": 7,
"set_on": true
}, {
"pin": 8,
"set_on": false
}, {
"pin": 9,
"set_on": false
}, {
"pin": 10,
"set_on": false
}, {
"pin": 11,
"set_on": false
}, {
"pin": 12,
"set_on": false
}, {
"pin": 13,
"set_on": false
}, {
"pin": 14,
"set_on": false
}, {
"pin": 15,
"set_on": false
}, {
"pin": 16,
"set_on": false
}, {
"pin": 17,
"set_on": false
}, {
"pin": 18,
"set_on": false
}, {
"pin": 19,
"set_on": false
}, {
"pin": 20,
"set_on": false
}, {
"pin": 21,
"set_on": false
}, {
"pin": 22,
"set_on": false
}, {
"pin": 23,
"set_on": false
}, {
"pin": 24,
"set_on": false
}, {
"pin": 25,
"set_on": false
}, {
"pin": 26,
"set_on": false
}, {
"pin": 27,
"set_on": false
}, {
"pin": 28,
"set_on": false
}, {
"pin": 29,
"set_on": false
}, {
"pin": 30,
"set_on": false
}, {
"pin": 31,
"set_on": false
}, {
"pin": 32,
"set_on": false
}
],
"trigger_type": 2,
"delay": 1000
}
As the nanoframework actually does not support generic collections I tried this:
Usually I got an ArrayList command.pin_setup with the structure as described in the JSON.
Mostly this works and I am able to access the elements by casting them into HashTable but sometimes this ArrayList contains elements of type JsonSerializerOptions. Do you have any idea why this happens and what the best way is to handle this kind of JSON if using ArrayList is not the best option?
Thanks in advance!
T.
P.S.: It seems that if it happens then only the first element in the ArrayList is of type JsonSerializerOptions.
Beta Was this translation helpful? Give feedback.
All reactions