Hola pues estoy tratando de recibir un json y deserializarlo, pero tengo algunos problmeas .... me está apareciendo el siguiente error :
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path 'user', line 1, position 9
//Aqui mando todo ...
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://miapi.com/auth/signin",
content);
var responseString = await response.Content.ReadAsStringAsync();
activityIndicator.IsRunning = false;
activityIndicatorLabel.IsVisible = false;
UserJson results = JsonConvert.DeserializeObject<UserJson>(responseString);
Este es el json que recibo y la clase con la que cacho.
{
"user": {
"id": 2,
"created_at": "2019-04-24T23:24:08.000Z",
"username": "ed",
"name": "..",
"lastnameP": "..",
"lastnameM": "..",
"pass": "$2a$10$7dDvKc5IM18y9qpnaz6HMetUS.wS/sPDnORLstrADbIMkcgFU7iiK",
"mail": "pushpoped@gmail.com",
"admin": 1,
"user": null,
"owner": null,
"gender": null,
"datenac": "2001-01-01T00:00:00.000Z",
"phone": "..",
"calle": "..",
"colonia": "..",
"estado": null,
"cp": 0,
"img": "165221da670877ef335069b14e8767aaaa32.jpg",
"id_usercreated": 0,
"status": "1"
}
}
using SQLite;
using System;
using System.Collections.Generic;
using System.Text;
namespace App_Intrustfund.Classes
{
public class UserJson
{
public int Id { set; get; }
public string Created_at { set; get; }
public string Username { set; get; }
public string Name { set; get; }
public string LastnameP { set; get; }
public string LastnameM { set; get; }
public string Pass { set; get; }
public string Mail { set; get; }
public int Admin { set; get; }
public int User { set; get; }
public int Owner { set; get; }
public string Gender { set; get; }
public string Datenac { set; get; }
public string Phone { set; get; }
public string Calle { set; get; }
public string Colonia { set; get; }
public string Estado { set; get; }
public string Cp { set; get; }
public string Img { set; get; }
public int Id_usercreated { set; get; }
public int Status { set; get; }
}
}