go-json
go-json copied to clipboard
Custom number format
Hello,
Is there a way to encode a float value as a 2 decimal string ? Even better, can a custom format be specified ? Example: following Go structure
type MyTest struct{
MyValue float `json:"myvalue",fmt:"# ##0.00"`
}
should give the following json; serialization / de-serialization should be possible :
{
"myvalue": "1 234.00"
}
Thank you for any idea !
I didn't understand why you needed this feature. Could you specifically explain why you need this feature ?