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

How can I ignore this empty field during JSON serialization? #4571

Open
zhaomingcheng01 opened this issue Jan 14, 2025 · 13 comments
Open

How can I ignore this empty field during JSON serialization? #4571

zhaomingcheng01 opened this issue Jan 14, 2025 · 13 comments

Comments

@zhaomingcheng01
Copy link

image
image
这样设置不生效啊

@feyounger
Copy link

i think code is

AlterPolicyUuid `json:"alterPolicyUuid,optional,omitempty"`

@zhaomingcheng01
Copy link
Author

image
image
没有用

@zhaomingcheng01
Copy link
Author

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image

@kesonan
Copy link
Collaborator

kesonan commented Jan 15, 2025

Are you sure it is the response structure which your log printed.

@zhaomingcheng01
Copy link
Author

这个是idea的debug监控器,不是手打印的日志

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This is the debug monitor of idea, not a hand-printed log.

@adamqddnh
Copy link

It would be best if you could provide the implementation code, including the JSON serialization and deserialization parts, cuz it looks like a usage issue.

最好能贴一下实现部分的代码,主要包含json序列化和反序列化部分,因为它看起来像是一个用法问题

In my code, it works when I curl the interface / 在我的代码中这种做法是可行的,截图是调用的接口返回截图
With no tag:
image
image

With tags:
image
image

@zhaomingcheng01
Copy link
Author

你是什么版本

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


what version are you

@adamqddnh
Copy link

你是什么版本

github.com/zeromicro/go-zero v1.6.6

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


What version are you on?

github.com/zeromicro/go-zero v1.6.6

@kesonan
Copy link
Collaborator

kesonan commented Jan 15, 2025

@zhaomingcheng01 Pls ask me on wechat group, @KE_SON_AN, let me check your code with you on remote.

@kevwan kevwan changed the title 这个json序列化我怎么忽略这个空字段呢 How can I ignore this empty field during JSON serialization? Jan 17, 2025
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

5 participants