How can we write Custom marshaller and unmarshaller for HLF chaincode? Need to upgrade chaincode and change the data type of a field from float64 to string.
If we just replace the data type in struct (Asset), both CreateAsset and GetAsset fail at json.Unmarshal() as it is unable to unmarshal the JSON.
eg.
original Asset struct:
type Asset struct{
Name string `json:"name"`
Cost float64 `json:"cost"`
}
new Asset struct: (chaincode upgraded)
type Asset struct{
Name string `json:"name"`
Cost string`json:"cost"`
}