Cysharp/WebSerializer

Nested query string does not work

Opened this issue · 2 comments

ITNOA

Hi

Description

I want to convert my below nested request to QueryString but I think ToQueryString does not work properly

            var parameter = new RulesCommandServiceAppendRequest()
            {
                Chain = Chain.INPUT,
                Data = new RuleInputModel()
                {
                    Protocol = "tcp",
                    SourceIp = "2.2.2.2",
                    DestinationIp = "1.1.1.1",
                    SourcePort = "111",
                    DestinationPort = "222",
                    Jump = "DROP"
                }
            };

Actual Behaviour

After I call WebSerializer.ToQueryString(parameter) I see below output:

Chain=INPUT&Data=DestinationIp=1.1.1.1&DestinationPort=222&Jump=DROP&Protocol=tcp&SourceIp=2.2.2.2&SourcePort=111"

Expected Behaviour

I expect my query string is like below:

Chain=INPUT&Data.DestinationIp=1.1.1.1&Data.DestinationPort=222&Data.Jump=DROP&Data.Protocol=tcp&Data.SourceIp=2.2.2.2&Data.SourcePort=111

What can I do?

maybe related to #3 ?

I also ask question about this in SQ https://stackoverflow.com/q/76873657/1539100