JSON
-
Golang에서 Json 사용예시Language/Golang 2023. 2. 7. 21:28
Json Parsing Go 에서는 Marchaling 된 Json 은 Byte Arrary 로 사용되며, UnMarshaling 의 경우 구조체나 map 과 같은 데이터로 치환하여 받을 수 있습니다. map 의 경우 Json Object를 의미하며, Array 의 경우 Json Array 로 표기됩니다. []byte -> map Json을 map 으로 변환합니다. 생성한 result 가 Json 형식과 맞지 않는 경우 실패처리 됩니다. package main import "fmt" import "encoding/json" func main() { b := []byte("{\"a\":10,\"b\":\"test\"}") result := make(map[string]interface{}) err := j..