"Go json.Valid()"의 두 판 사이의 차이

잔글 (Jmnote님이 Go isJSONString() 문서를 Go json.Valid() 문서로 이동했습니다)
 
(차이 없음)

2025년 2월 18일 (화) 16:34 기준 최신판

1 개요[ | ]

Go json.Valid()
Go
Copy
package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	goodJSON := `{"example": 1}`
	badJSON := `{"example":2:]}}`

	fmt.Println(json.Valid([]byte(goodJSON))) // true
	fmt.Println(json.Valid([]byte(badJSON)))  // false
}


2 같이 보기[ | ]