Typescript client send KeyValuePair<string, any>[ ][ ]

Hi,

I’m trying to send a KeyValuePair<string, any>[][] to a Service but getting a bad request using v4.5.14 and the Typescript client.

Service DTO

public List<List<KeyValuePair<string, dynamic>>> KeyValueList { get; set; }

If I look at the request the KeyValueList is sent as [object Object] and I get a SerializationException.

"Errors":[{"ErrorCode":"SerializationException","FieldName":"KeyValueList","Message":"'[object Object]' is an Invalid value for 'KeyValueList'"}]

Could someone please point me in the right direction to get this working.

Thanks.

Dynamic or object is not supported, send a string if you want it untyped.

I’ve changed the signature to:

public List<List<KeyValuePair<string, string>>> KeyValueList { get; set; }

Typescript client sends the KeyValuePair<string, string >[][] as [object Object] which has the same exception.

{“ResponseStatus”:{“ErrorCode”:“SerializationException”,“Message”:“Unable to bind to request ‘XXX’”,“StackTrace”:" at ServiceStack.Serialization.StringMapTypeDeserializer.PopulateFromMap(Object instance, INameValueCollection nameValues, List`1 ignoredWarningsOnPropertyNames)\r\n at ServiceStack.Host.Handlers.ServiceStackHandlerBase.DeserializeHttpRequest(Type operationType, IRequest httpReq, String contentType)\r\n at ServiceStack.Host.Handlers.GenericHandler.CreateRequest(IRequest req, String operationName)\r\n at ServiceStack.Host.Handlers.GenericHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName)",“Errors”:[{“ErrorCode”:“SerializationException”,“FieldName”:“KeyValueList”,“Message”:"’[object Object]’ is an Invalid value for ‘KeyValueList’"}],“Meta”:null}}

Then must be an issue with deeply nested generics, try:

public class Pair
{
    public string Key { get; set; }
    public string Value { get; set; }
}

...
public List<List<Pair>> KeyValueList { get; set; }

No joy. Query string parameters still show KeyValueList as [object Object]

You’re not going to be able to send nested complex types on the querystring it should be sent in the Request Body as JSON.