Skip to content

Go lang Json custum encoder

jaeseok.an edited this page Apr 26, 2019 · 1 revision

Json custom encoder/decoder

참고

존재하는 type을 다르게 json으로 encoding/decoding 하는 방법

  • json용 새로운 type을 만든다.
  • 원래 type에 MarshalJSON(), UnmarshalJSON()을 만든다.
  • 이 함수에서 json용 type을 이용하여 encoding/decoding 한다.

test

Clone this wiki locally