smartcontract: simplify Array JSON marshalling

This commit is contained in:
Roman Khimov 2020-03-31 00:27:58 +03:00
parent 3dbe549a61
commit 25201d480d

View file

@ -82,14 +82,7 @@ func (p *Parameter) MarshalJSON() ([]byte, error) {
resultRawValue, resultErr = json.Marshal(hex.EncodeToString(p.Value.([]byte)))
}
case ArrayType:
var value = make([]json.RawMessage, 0)
for _, parameter := range p.Value.([]Parameter) {
rawValue, err := json.Marshal(&parameter)
if err != nil {
return nil, err
}
value = append(value, rawValue)
}
var value = p.Value.([]Parameter)
resultRawValue, resultErr = json.Marshal(value)
case MapType:
ppair := p.Value.([]ParameterPair)