UPS标签生成具有多行地址的Restful API

发布于 2025-01-22 20:49:34 字数 443 浏览 0 评论 0原文

我正在尝试生成带有多行地址的标签。...文档说地址线的出现可能出现三遍。但是,这是无效的JSON,我不确定该如何进行。

Address: &ShipmentAddress{
        AddressLine: `Street Value \n Suite122`
        City:              "City",
        StateProvinceCode: "State",
        PostalCode:        "ZIP",
        CountryCode:       "COUNTRY",
    },

上述值不起作用。

docs

I am trying to generate a label with a multiline address.... the docs say the occurrence of AddressLine can appear three times. however this is invalid json and I am not sure how to go about it in GO.

Address: &ShipmentAddress{
        AddressLine: `Street Value \n Suite122`
        City:              "City",
        StateProvinceCode: "State",
        PostalCode:        "ZIP",
        CountryCode:       "COUNTRY",
    },

The above value does not work.

Docs

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

手长情犹 2025-01-29 20:49:34

https://go.dev/play/play/p/10sz63fskaf

    fmt.Println(`This is a
multiline
string.`)
    fmt.Println("And this is a\nmultiline\nstring too!")

https://go.dev/play/p/10SZ63FSKAf

    fmt.Println(`This is a
multiline
string.`)
    fmt.Println("And this is a\nmultiline\nstring too!")
嘿咻 2025-01-29 20:49:34

当文档说它支持3个发生时,这意味着它可以像示例中的字符串一样,或者最多3个字符串元素。 [“ 123街”,“ 5室”]

将获得一个标签:

123 Street
房间5

When the docs says it supports 3 occurrences they mean that it can be either just a string like in your example or an array up to 3 string elements. ["123 Street", "Room 5"]

Would get a label of:

123 Street
Room 5

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文