mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
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:
parent
4a1c0d7124
commit
ac628a9427
3 changed files with 148 additions and 41 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue