Hello,
I’m using SimpleJson as my parser and builder:
link text
I do I write my Json tree like this in script? It must look something like this:
{
"email": "user email will be here"
{
"username": "username will be here",
"password": "password will be here"
}
}
This is what I have so far:
JSONNode N = null;
N ["email"] = email;
N ["email"] ["username"] = username;
N ["email"] ["password"] = password;
// the "N" must be taken as one.
The json object you’re attempting to create is not valid json. This is what you’re after:
{
"email": "email will be here",
"login":
{
"username": "username will be here",
"password": "password will be here"
}
}
You can generate this using SimpleJSON as follows:
var node = new JSONObject();
node["email"] = "some@email.com";
node["login"] = new JSONObject();
node["login"]["username"] = "AzureDiamond";
node["login"]["password"] = "hunter2";
Debug.Log(node);
Some things to consider:
-
Unity has JSON built in, there’s no need to use SimpleJSON
- You should absolutely not be storing login details in plain text like JSON
Hello and thank you for your response.
There should be a way to secure the json. Correct?