Open wujiang41105631 opened 1 month ago
All JSON data types are valid, even strings.
"123"
is valid because JSON accepts it as {"age": 123}
. gjson.Valid
removes the quotation marks. However, "adam"
is not valid because JSON does not accept something like {"name": adam}
; It should be wrapped with quotation marks like: "\"adam\""
to become valid.
examples: 123, is valid as number null, is valid as null "hello", valid as string "123" valid as string true, valid as boolean false, vald "true" valid as string "false" valid as string
but
hello, invalid, should wrap by quotation
When I was using the method gjson.Valid(str), I found that if str is a string of pure numbers, for example, str := "123123123", the return result of this method is also true.