I get from the json site which contains a bunch of arrays and properties by type =>

{ "Status":true "Data":{...} "INFO":["info1", "info2", "info3"] } 

I'm interested in the INFO array, which can contain from 1 to 5 lines. How can I get it separately, ignore other data, such as status and data?

  • 3
    Possible duplicate question: How to parse an object of this kind on c #? - tym32167
  • one
    in this case, I wonder how to do it with JsonUtility, because here Unity - OVDEN
  • Please indicate this in the question, since, as far as I understand, json.net can also be used in unity. - tym32167
  • one
    and, by the way, this "INFO":{info1, info2, info3} is not an array. This is an object with info1, info2, info3 fields that have not been set. I'm not sure that this is a valid json - tym32167
  • In my case, the documentation says that this is an "Array of character codes." - OVDEN

1 answer 1

I figured it out myself.

create class

 public class ClassName { public string[] INFO; } 

Next, do

 ClassName info = JsonUtility.FromJson<ClassName>(myjson); 

In short, I simply did not know that it was enough that the variable names would coincide.