insane-json
insane-json copied to clipboard
Invalid json is being validated
» echo "{"field1":"email\SECMASKED"}" | jq 5
jq: parse error: Invalid numeric literal at line 1, column 9
but check is passed
func TestDecodeSpecialChar(t *testing.T) {
json := `{"field1": "email\SECMASKED"}`
root, err := DecodeString(json)
defer Release(root)
assert.NoError(t, err, "error while decoding")
assert.NotNil(t, root, "node shouldn't be nil")
assert.True(t, root.IsObject(), "wrong first node")
}
u just unescaped \ in ur bash scripts, but in go u have used tick notation for strings, so encapsulation is not required
~ echo -E '{"field1":"email\\SECMASKED"}' | jq
{
"field1": "email\\SECMASKED"
}
@ythosa the ploblem is that the invalid json {"field1":"email\SECMASKED"} is valid for insane-json
the problem is the encapsulation of "". JSON is valid...