Your json string is not valid json - the wrapping {}
are invalid. You should check how the json string is generated / encoded inside your php API.
将JSON转换为对象
i have a method that sends a POST
Request to my PHP API and the API responds with a JSON String return value.
however after using JsonConvert.DeserializeObject()
to the JSON result, i am getting this format
{[
{
"usr_name": "12-34567",
"usr_fullname": "LASTNAME, FIRSTNAME MIDDLENAME",
"usr_emailaddress": "myemail@mail.com",
"photo_url": "http://mywebsite.com/fetch_photo.php?id=MTItNDA1MDY=",
"token": "64c420939814c62889ea143d17736841"
}
]}
however i am not able to Deserialize
it to my Class that is structured like below
public class MyObject
{
public string usr_name { get; set; }
public string usr_fullname { get; set; }
public string usr_emailaddress { get; set; }
public string photo_url { get; set; }
public string token { get; set; }
}
i am using Newtonsoft JSON.Net for this purpose, this is my first time dealing with JSON inside C# so i am quite clueless no how or what to do. i've done several research only to find outdated tutorials or questions unlike my returned JSON value
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答
3条回答
为你推荐
- 如何将JAVA数组转换成 JSON对象或JSON字符串
- 在golang中使用反射将json转换为结构
- reflection
- json
- 1个回答
- 如何将包含数组的JSON对象转换为单个Struct实例
- json
- 1个回答
- 如何将JSON对象转换为MySQL行?
- 将JSON对象数组转换为YAML
- yaml
- json
- 2个回答
- 将JSON成员字符串转换为JSON对象
- json
- 1个回答
- 如何将JSON数组转换为对象
- json
- 1个回答
- 无法将地图对象转换为JSON对象
- dictionary
- 1个回答
- 将结构转换为json数组而不是json对象
- json
- 2个回答
- 如何正确将json字符串转换为对象
- IT行业问题
- 计算机技术
- it技术
- 编程语言问答
- 互联网问答
- 1个回答
- 将JSON转换为对象
- Json字符串转换为json对象
- 将多维php数组转换为JSON对象数组
- java获取json参数,JSONObject转换为java对象
- java
- 7个回答
- 将json对象转化为java对象?
- json
- 强制类型转换
- 0个回答
- JAVA 对象中包含了JSON集合 怎么把JSON转换成集合
- JSON转为对象集合 忽略 某些 属性不接受
- 对象
- json
- api
- 转换
- 10个回答
- 怎么把json转成a的实体对象?
- string
- 对象
- json
- class
- 4个回答
- servlet中Gson转换Json数据为对象,获取对象属性时报空指针问题,求解答
- 对象
- servlet
- json
- 4个回答
- json格式的字符串转化为java对象
- json
- 5个回答