I have a xml item tag which should be mapped into List. But while mapping apart from the list of item other elements has been mapped to the model.
I referred to other questions where each items is given a parent so they mapped while deserialising.
Let me know how to map to the given list item into the respective model.
XML:
<SecretModel>
<id>3181</id>
<name>Test</name>
<secretTemplateId>6044</secretTemplateId>
<folderId>674</folderId>
<active>true</active>
<items>
<itemId>13960</itemId>
<fileAttachmentId/>
<filename/>
<itemValue>Test</itemValue>
<fieldId>287</fieldId>
<fieldName>Username</fieldName>
<slug>username</slug>
<fieldDescription>The Amazon IAM username.</fieldDescription>
<isFile>false</isFile>
<isNotes>false</isNotes>
<isPassword>false</isPassword>
</items>
<items>
<itemId>13961</itemId>
<fileAttachmentId/>
<filename/>
<itemValue>AKIAU5G4MQBA2TKQOWNW</itemValue>
<fieldId>284</fieldId>
<fieldName>Access Key</fieldName>
<slug>access-key</slug>
<fieldDescription>The Amazon IAM access key.</fieldDescription>
<isFile>false</isFile>
<isNotes>false</isNotes>
<isPassword>false</isPassword>
</items>
</secretModel>
SecretModel.cs:
Public class SecretModel
{
public int? id {get; set;}
public string name {get; set;}
public string SecretTemplateID {get; set;}
public string folderId {get; set;}
public string active {get; set;}
public string List<RestSecretItem> {get; set;}
}
public partial class RestSecretItem : IEquatable<RestSecretItem>
{
public string FieldDescription { get; set; }
public int? FieldId { get; set; }
public string FieldName { get; set; }
public int? FileAttachmentId { get; set; }
public string Filename { get; set; }
public bool? IsFile { get; set; }
public bool? IsNotes { get; set; }
public bool? IsPassword { get; set; }
public int? ItemId { get; set; }
public string ItemValue { get; set; }
public string Slug { get; set; }
}