We will be converting a Block to a JSONBlock. A JSONBlock is a struct ) than can be easily marshaled into a JSON by the json.Marshal function.
Create a Marshal pointer receiver function for an Aurum block. The function should return a the struct created above. Numerical values and string to do not have to be changed, but any byte slices must be hex encoded into strings.
The whole point is to turn the Block struct into a struct that can be easily marshaled into a JSON.
The unit test TestMarshal (in block_test.go) must pass.
Package Context:
internal/block
Branch Context:block_json
We will be converting a Block to a JSONBlock. A JSONBlock is a struct ) than can be easily marshaled into a JSON by the json.Marshal function.
Create a
Marshal
pointer receiver function for an Aurum block. The function should return a the struct created above. Numerical values and string to do not have to be changed, but any byte slices must be hex encoded into strings.The whole point is to turn the Block struct into a struct that can be easily marshaled into a JSON. The unit test
TestMarshal
(inblock_test.go
) must pass.Resources: https://www.json.org/ https://en.wikipedia.org/wiki/Marshalling_(computer_science)