mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-26 14:39:24 -06:00
13 lines
260 B
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
|
|
}
|