Deserialize Json array with mixed types
I have a json which Looks like the following:
{\"row\":[208,\"TEXT.\",816,252,\"TEXT\"]}
Ideally i want an object like this one:
public class row { public int var1; public string var2; public int var3; public int var4; public string var5; }
allthough a object Array (object[]) would be fine too. From there I could create my other objects.
My approaches
I have tried this solution about handling json Arrays in Unity with a wrapper class: LINK
Which is based on this Post
But this solution only handles arrays with one datatype. My Json involves strings AND int... (so objects) I have tried many different classes but nothing worked.
Workaround
I guess I could parse the string and manually scrap out all the values, or modify the json to something, wehere I can directly deserialize to a "row-object" (e.g. "convert" the object Array to single properties). But this seems not to be a nice answer...
Detail:
1) Sadly I cannot user the NewtonSoft library due to TargetFramework reasons.
2) Lanuage: C# v4
3) Unity Version: 2017.3.1f1
Any hint would be appreciated!
Your answer
Follow this Question
Related Questions
Error CS0118: Armor.DisplayName is a property but a type was expected 0 Answers
SHA512 JS -> C# 0 Answers
How to work with Timestamp data in Unity 0 Answers
One JSON file, multiple objects, multiple scenes... 0 Answers
Destroy, deactive or hide 0 Answers