I'm having troubles trying to parse a json into a string array in unity. It works just fine, but when I receive decimals it doesn't work.
My response class:
public class Response
{
public string[] data;
public string key;
public string hash;
public string error;
public string callback;
}
And my json
{
"data":[11,0,962609.4],
"key":"5a1d521ebaac844bf98a78689f4acdf8",
"hash":"9ed52bfcc53e823511f1fccad862900b",
"error":0,
"callback":""
}
The problem occurs when parsing data, it just stays null.
This json works perfectly:
{
"data":[11,0,962609],
"key":"5a1d521ebaac844bf98a78689f4acdf8",
"hash":"9ed52bfcc53e823511f1fccad862900b",
"error":0,
"callback":""
}
This is how I parse the json
var response = JsonUtility.FromJson<Response>(json);
HandleResponse(response, callback);
UPDATE: I realized that it happens with another examples like:
{
"data":[0,0,0],
"key":"6d8dfe0fc69adb1b9eec886fc2385392",
"hash":"52e388c48d705e4351415aa5f9237150",
"error":2,
"callback":""
}
Now I'm really lost.
Thanks you guys.