insane-json icon indicating copy to clipboard operation
insane-json copied to clipboard

Invalid json is being validated

Open DmitryRomanov opened this issue 2 years ago • 3 comments

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

DmitryRomanov avatar Dec 21 '23 11:12 DmitryRomanov

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 avatar Jan 20 '24 21:01 ythosa

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

DmitryRomanov avatar Jan 22 '24 06:01 DmitryRomanov

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

ythosa avatar Feb 28 '24 09:02 ythosa