Issue with JSON Serialisation
When converting from object to json i need my list of object to be as follows
"group": [{
"item": {},
"item": {}
}]
Instead I am getting
"group": [{
"item": [
{},
{}
]
}]
How would I create my object to serialise it in the correct way?
Thanks in advance
10 Replies
currently the group class looks like this
I mean... you declared item as a list of objects lol
So it serialized to a json list
so i cant really make it serialise the correct way?
without making a custom toJson method
Err, i mean if you don't want it to be a list don't make it a list
It's doing it the correct way right now
but then how do i allow multiple
I mean... u use a list lol like ur doing
Which will generate a json with a list
This first example only allows one item
So it doesn't allow multiple
which means i need a custom ToJson method for it i guess
No...
You don't
This is a weird question cuz you want a list but you want it to not be a list?
Like that makes 0 sense
i may have been misreading the json
havent been working with json in years
yeah im stupid and i got it, thanks
👍