JSONObject.AddField C# (CSharp) Method

AddField() public method

public AddField ( string name, AddJSONConents content ) : void
name string
content AddJSONConents
return void
	public void AddField(string name, AddJSONConents content)
	{
		AddField(name, Create(content));
	}
	public void AddField(string name, string val)

Same methods

JSONObject::AddField ( string name, JSONObject, obj ) : void
JSONObject::AddField ( string name, bool val ) : void
JSONObject::AddField ( string name, float val ) : void
JSONObject::AddField ( string name, int val ) : void
JSONObject::AddField ( string name, string val ) : void

Usage Example

Example #1
0
        public KnetikApiResponse Register(
			string username,
			string password,
			string email,
			string fullname,
			Action<KnetikApiResponse> cb = null
		)
        {
            // Login as a guest
            KnetikApiResponse loginResponse = GuestLogin ();

            if (loginResponse.Status != KnetikApiResponse.StatusType.Success) {
                Debug.LogError("Guest login failed");
                return loginResponse;
            }
            Debug.Log ("Guest login successful");

            // Then register the new user
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("username", username);
            j.AddField ("password", password);
            j.AddField ("email", email);
            j.AddField ("fullname", fullname);

            String body = j.Print ();

            KnetikRequest req = CreateRequest(RegisterEndpoint, body);

            KnetikApiResponse registerResponse = new KnetikApiResponse(this, req, cb);
            return  registerResponse;
        }
All Usage Examples Of JSONObject::AddField