Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid json is being validated #13

Open
DmitryRomanov opened this issue Dec 21, 2023 · 3 comments
Open

Invalid json is being validated #13

DmitryRomanov opened this issue Dec 21, 2023 · 3 comments

Comments

@DmitryRomanov
Copy link

DmitryRomanov commented Dec 21, 2023

» 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")
}
@ythosa
Copy link

ythosa commented Jan 20, 2024

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"
}

@DmitryRomanov
Copy link
Author

@ythosa the ploblem is that the invalid json {"field1":"email\SECMASKED"} is valid for insane-json

@ythosa
Copy link

ythosa commented Feb 28, 2024

the problem is the encapsulation of "". JSON is valid...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants