Deserializing GET QueryString arrays

I have an angularJS (1.X) app serializing a querystring paramter which is an array of values, and sending that to a ServiceStack service.

The JSON object being serialized by angular is:

    FromDateUtc: "2018-04-22T12:00:00.000Z",
    PeriodRanges: [

Angular serializes the PeriodRanges property as a QueryString param on the wire as:


decoded (for easier reading):


Now that arrives at my service, for a DTO defined as:

    public class HasReportAndPeriodRanges
        public DateTime FromDateUtc { get; set; }

        public DateTime? ToDateUtc { get; set; }

        public List<PeriodRange> PeriodRanges { get; set; }

    public class PeriodRange
        public DateTime FromDateUtc { get; set; }

        public DateTime ToDateUtc { get; set; }

Which is not correctly getting deserialized.

I’ve not encountered using arrays as GET QueryStrings in ServiceStack.
Do I have to something special to make that GET request serialize properly?

You can only send complex types on QueryStrings using JSV, If you want to send JSON you need to send it in the Request Body, e.g. using POST/PUT/PATCH.

Ah OK! so I need to do something special in the angular to convert that stuff to a JSV value then?
OR option 2, redesign to be a POST method.

Is there anything (library etc) that can help me serialize my value to JSV in the angular code?

JSV provides a human friendly way to construct urls manually, e.g


But if you’re trying to send a serialized object then I’d use POST.

Thanks. I used the: JSV.serializeArray() method from:

As I dont think converting to a POST is semantically the right thing to do in this case.
Worked a treat actually.


Semantically ?queryStrings should not have complex types, and why there’s no standard for it.