API: Improve MarshalToJson() in common/reflect/marshal.go (#3655)
* Serialize enum to string in MarshalToJson(). * MarshalToJson() respect json tags. * Add insertTypeInfo parameter to MarshalToJson(). * Omit empty string in MarshalToJson(). * Serialize PortList to string in MarshalToJson(). --------- Co-authored-by: nobody <nobody@nowhere.mars>
This commit is contained in:
1 parent
4a1c0d7124
commit
ac628a9427
3 files changed
+148
-41
No files matched your search
@@ -17,7 +17,7 @@ func MergeConfigFromFiles(files []string, formats []string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if j, ok := creflect.MarshalToJson(c); ok {
|
||||
if j, ok := creflect.MarshalToJson(c, true); ok {
|
||||
return j, nil
|
||||
}
|
||||
return "", errors.New("marshal to json failed.").AtError()
|
||||
|
||||
Reference in new issue
Block a user