我使用df1 <- structure(list(Col1 = c("China", "Japan", "US", "Canada")),
.Names = "Col1", class = "data.frame", row.names = c(NA, -4L))
并需要发送到服务器对象列表#include<iostream>
int main(){
std::string s = " α a ";
std::cout << "s = " << s << std::endl;
for(std::string::iterator c = s.begin(); c != s.end(); ++c){
if(*c == 'a') std::cout << "letter a" << std::endl; // ok
if(*c == 'α') std::cout << "greek letter alpha" << std::endl; // error: character too large
std::cout << *c << std::endl;
}
return 0;
}
和Volley
。
User
上课:
List<Integer>
我使用代码
User
问题是JSONObject无法解析public class User {
public int id;
public String name;
public MyClass(int id, String name){
this.id = id;
this.name= name;
}
}
HashMap<String, Object> params = new HashMap<>();
List<Integer> categories = new ArrayList<>(Arrays.asList(5, 8, 9));
List<User> users = new ArrayList<>(Arrays.asList(
new User(1, "User1"),
new User(2, "User2"),
new User(3, "User3")
));
params.put("categories", categories);
params.put("users", users);
JSONObject jsonBody = new JSONObject(params);
如何使用User
解析它?
参数“{
"users": [
null,
null,
null
],
"categories": [
5,
8,
9
]
}
”应为JSONObject
而不是users
。
我需要array
,因为string
使用它
JSONObject
完整代码:
Volley