所需格式
{
"credentials": {
"username": "foobar2",
"password": "Demandware1"
},
"profile": {
"email": "dude@demandware.com",
"birthday": "2011-05-06",
"fax": "",
"first_name": "",
"gender": "m",
"job_title": "",
"last_name": "",
"phone_business": "",
"phone_home": "",
"phone_mobile": "",
"preferred_locale": "en-US",
"salutation": "",
"second_name": "",
"suffix": "",
"title": ""
}
}
当前格式
{
"credentials": {
"username": "aaa",
"password": "aaa",
"profile": {
"email": "admin1@photon.com",
"birthday": "2011-12-12",
"fax": "",
"first_name": "",
"gender": "",
"job_title": "",
"last_name": "",
"phone_business": "",
"phone_home": "",
"phone_mobile": "",
"Preferred_locale": "a",
"salutation": "",
"second_name": "",
"suffix": "",
"title": ""
}
}
}
当前的 Json 代码
JObject JsonRegInput = new JObject(
new JProperty("credentials",
new JObject(
new JProperty("username", loginData.username = username),
new JProperty("password", loginData.password = password),
new JProperty("profile",
new JObject(
new JProperty("email", RegisterObject.email = email),
new JProperty("birthday", RegisterObject.birthday = birthday),
new JProperty("fax", RegisterObject.fax = ""),
new JProperty("first_name", RegisterObject.first_name = ""),
new JProperty("gender", RegisterObject.gender = ""),
new JProperty("job_title", RegisterObject.job_title = ""),
new JProperty("last_name", RegisterObject.last_name = ""),
new JProperty("phone_business", RegisterObject.phone_business = ""),
new JProperty("phone_home", RegisterObject.phone_home = ""),
new JProperty("phone_mobile", RegisterObject.phone_mobile = ""),
new JProperty("Preferred_locale", RegisterObject.preferred_locale = pref_local),
new JProperty("salutation", RegisterObject.salutation = ""),
new JProperty("second_name", RegisterObject.second_name = ""),
new JProperty("suffix", RegisterObject.suffix = ""),
new JProperty("title", RegisterObject.title = ""))))));
我正在提供注册请求以及输入。我已经编写了 JSON 注册格式,但我没有获得所需的格式。告诉我我必须在哪里更改代码。
在当前格式中,最后我得到了 3 个右括号。但我的要求是在末尾带两个右括号,另一个在密码末尾。请看我的代码。