Hi,
i have problems with serializing and deseralizing back to my class.
Convert JsonObject back to ob
I have a collection like this IReadOnlyCollection<CompanyCustomer>
public class CompanyCustomer
{
public Guid? CompanyId { get; set; }
public Guid? CustomerId { get; set; }
}
This works fine to serialize into json
Example
[{"CompanyId":"00000000-0000-0000-0000-000000000000","CustomerId":"00000000-0000-0000-0000-000000000001"},{"CompanyId":"00000000-0000-0000-0000-000000000001","CustomerId":"00000000-0000-0000-0000-000000000001"}]
I then save it into a JSONObject (my JWTToken)
string jsonString = jsonSerialiser.Serialize(membershipSession.CompanyCustomers);
token.Add("CompanyCustomers", jsonString);
But when i try to deserialize it back it get an error
membershipSession.CompanyCustomers = jsonSerialiser.Deserialize<IReadOnlyCollection<CompanyCustomer>>(token["CompanyCustomers"]);
Invalid JSON primitive: 00000000-0000-0000-0000-000000000000.
Please help