I’m trying to generate a json file from the following class.
[serializable]
public class IndexData
{
public string[ ][ ] categoryBundleName;
public string[ ] categoryName;
}
I’m getting result as
{
“categoryName”: [ ]
}
Does anyone know how to create a special json like this?
What do you mean by special? Isn’t your categoryBundleName not just an object with two arrays in it?
{
"categoryBundleName":[
{
"categoryName":[
{
"name":"your string"
},
{
"name":"another string"
}
],
"categoryWhatever":[
{
"name":"your string"
},
{
"name":"another string"
}
]
}
]
}
Thanks, appreciate the support.
My requirement is same as your response. To get that result, what would be my class?
Something like this:
public class CategoryName
{
public string name { get; set; }
}
public class CategoryWhatever
{
public string name { get; set; }
}
public class CategoryBundleName
{
public List<CategoryName> categoryName { get; set; }
public List<CategoryWhatever> categoryWhatever { get; set; }
}
public class RootObject
{
public List<CategoryBundleName> categoryBundleName { get; set; }
}