Can't read Json in WPF
I don't think I understand this error. It requires an array? but how? Should I make a loop?
8 Replies
So basically, The program runs just fine when Json is empty. But as soon there is something inside the Json it fails, because it isn't an array?
I got some help yesterday so I could write to my Json. I can't read it though
show the json
I tried that, it worked with Javascript, but c# removes it when I write to Json
It's just above
and show the persondata class
The person data class is this
Thanks
hmm.. That is true, I am only making one object. But should I not be doing that, making a new object foreach click?
also the names in the json are in a different case
I know what you mean now. I am adding one object, and reading it as a list, which it isn't, it is not a list. So I need to find a way to write objects as a list
That sounds nice, and easy. Maybe too easy... I'll try that
<a:aPES_Think:493353113332219924>
Like this right?
oh I see yeah, let me do that to the writing method too
I tried something, it suddenly dosen't like it though
It says "Does not contain a definition for
Name, Address, City
"
Hm. the error first appeared when I added List
. So the name should be fine I guess? I could try to rename everything, just to get a better view
Hmm true, I have tried something new
I have also made a constructor now, I don't know if that is correct thoughyou're only serializing that one persondata you made
you never added it to the list, nor are you serializing the list