Files
pgbackweb/internal/validate/json.go

13 lines
260 B
Go

package validate
import (
"encoding/json"
)
// JSON validates a JSON string, it returns a boolean indicating whether
// the JSON is valid or not.
func JSON(jsonStr string) bool {
var js json.RawMessage
return json.Unmarshal([]byte(jsonStr), &js) == nil
}