Unity json not deserialize correctly

With this class

public class ALLTrackerPropertiesServer
{
    public List<TrackerPropertiesServer> objs;
}
[Serializable]
public class TrackerPropertiesServer
{
    public int id = 0;
    public int uses = -1;
    public string contentDownloadUrl = "";
    public string Contents = "";
    public string MarkerlessContents = "";
    public int MarkerlessDefault = 1;
}

I get this error

ArgumentException: JSON must represent an object type.

Using this code

 ALLTrackerPropertiesServer unitymaledetto= JsonUtility.FromJson(json);

With this json

[{"id":1,"uses":"-1","contentDownloadUrl":"http:\/\/b-sito\/ac1.jpg","Contents":"1","MarkerlessContents":"1","MarkerlessDefault":"3"},{"id":2,"uses":"-1","contentDownloadUrl":"http:\/\/b-sito\/ac1.jpg","Contents":"1","MarkerlessContents":"1","MarkerlessDefault":"3"}]

Why??

Unity’s JsonUtility can only deserialize json that has an object as root element. As Hellium said your json has an array as root element. This is not supported by Unity’s JsonUtility. Though you can wrap your json in an object.

JsonUtility.FromJson<ALLTrackerPropertiesServer>("\"objs\":{" + json + "}");

This should work as expected with your given classes. Of course your “ALLTrackerPropertiesServer” class also need to have the Serializable attribute which you may just have forgotten to copy here. Though if not make sure you add that attribute as well.