String str ="{\"_id\":\"eta_emp_1\",\"_rev\":\"446-195e9341df50aeed33d2cb833420b100\",";
str+="\"channels\":[\"ch_pri-eta_org\"],\"doc_type\":\"emp\",\"downloaded\":true,";
str+="\"eta_code\":\"abhi\",\"f_name\":\"Abhilash\",\"isactive\":true,";
str+="\"isadmin\":true,\"l_name\":\"Dhondalkar\",";
str+="\"lat\":17.69967582522918,\"lon\":75.89857880026102,";
str+="\"m_name\":\"Dheeraj\",\"mod_at\":1494693566503,\"mod_by\":\"eta_emp_1\",";
str+="\"org_id\":\"eta_org\",\"pwd\":\"abcde\",";
str+="\"reported_by\":[\"e27f41e7-5b84-4c86-838e-97598b4d20a0\",\"8daa0901-f6e8-4fdd-b41c-658aa901899d\",";
str+="\"9bf72297-481c-4d59-a0f4-d5549cb60e27\",\"2e5ce994-2cfb-4e62-88f8-ff1d3a069ca0\"]}";
UserDetails userDetails = JsonConvert.DeserializeObject<UserDetails>(str);
public class UserDetails
{
String _id{get;set;}
String _rev { get; set; }
String[] channels{get;set;}
String doc_type{get;set;}
bool downloaded{get;set;}
String eta_code{get;set;}
String f_name{get;set;}
bool isactive { get; set; }
bool isadmin { get; set; }
long l_name{get;set;}
long lat{get;set;}
String lon{get;set;}
String m_name{get;set;}
long mod_at{get;set;}
String mod_by{get;set;}
String org_id{get;set;}
String pwd{get;set;}
String[] reported_by{get;set;}
}
所有值均設置爲空。 無法找出問題。 Pl幫助將所有值設置爲空的反序列化返回對象
你從哪裏得到你的'string'?通常當反序列化/序列化時,你不需要使用'str + =',因爲它通常只有一個'字符串'。 –