Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于输出 json 结构的顺序问题 #38

Open
love4taylor opened this issue Apr 10, 2024 · 3 comments
Open

关于输出 json 结构的顺序问题 #38

love4taylor opened this issue Apr 10, 2024 · 3 comments

Comments

@love4taylor
Copy link

能否保持输入模版的结构顺序

@xmdhs
Copy link
Owner

xmdhs commented Apr 11, 2024

现在应该是保持了模板的顺序

@love4taylor
Copy link
Author

我这没变化,还是乱的

input

{
  "log": {
    "disabled": false,
    "level": "info",
    "timestamp": false
  },
  "dns": {
    "servers": [
      {
        "tag": "novaxns",
        "address": "",
        "detour": "direct"
      },
      {
        "address": "rcode://success",
        "tag": "block"
      }
    ],
    "rules": [
      {
        "domain_suffix": [
          ".arpa.",
          ".arpa"
        ],
        "server": "block"
      }
    ]
  },

......

output

{
    "dns": {
        "rules": [
            {
                "domain_suffix": [
                    ".arpa.",
                    ".arpa"
                ],
                "server": "block"
            }
        ],
        "servers": [
            {
                "address": "",
                "detour": "direct",
                "tag": "novaxns"
            },
            {
                "address": "rcode://success",
                "tag": "block"
            }
        ]
    },
    "experimental": {
        "cache_file": {
            "enabled": true
        },
        "clash_api": {
            "external_controller": "127.0.0.1:9090",
            "secret": ""
        }
    },

......

@xmdhs
Copy link
Owner

xmdhs commented Apr 11, 2024

Go 的 map 就是乱序的,所以不太好保持模板的顺序。但是规则之类的是有顺序的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants