I’m doing the following: (Don’t worry it will be over HTTPS)
UnityWebRequest.Post(url,jsonData)
The json data is as follows: {"username":"some username","password":"some password"}
The data is actually of type JsonObject but I’ve tried passing it as a string too.
When using PostMan tool in Chrome and sending this data it was processing correctly.
When sending via Unity I get additional data that fails Json linter:
{ '{"translationKey":"","username":"","password":""}': '' }
I have tried manually stripping the code; but I’d rather be sending safe json to begin with.
I’m using Express with NodeJS.
Can someone tell me what I’m doing wrong?
** Edit **
I’m using JsonUtility.ToJson(jsonData) to parse the data
Example of Json class:
public class JsonObjectNewUser : JsonObjectBase {
public string username;
public string password;
public JsonObjectNewUser(string username, string password) {
this.username = username;
this.password = password;
}
}
BaseJson
[System.Serializable]
publicclassJsonObjectBase{
publicstringtranslationKey="";
}
Logging JsonUtility.ToJson(jsonObject) produces the correct json:
{
"translationKey": "",
"username": "",
"password": ""
}
So something is being added in UnityWebRequest.Post…