Issue with Json parsing for a single quote within double quote
PraveenKumarPrecisely opened this issue · 2 comments
PraveenKumarPrecisely commented
Hi Team,
We noticed an issue with the code present in your java file (ExpressionsVisitor.java at Line no 390-393).
\\This line throws an exception for the below input json file.
if ((str.startsWith("`") && str.endsWith("`")) || (str.startsWith("\"") && str.endsWith("\""))
|| (str.startsWith("'") && str.endsWith("'"))) {
str = str.substring(1, str.length() - 1);
}
It breaks if gives the following JSON value:
{
"Account": {
"Account Name": "'"
}
}
I would suggest making the following changes:
\\First we should check the length must be greater than 1 otherwise it is of no use to check for start and end string.
if (str.length() > 1 && (str.startsWith("`") && str.endsWith("`")) || (str.startsWith("\"") && str.endsWith("\""))
|| (str.startsWith("'") && str.endsWith("'"))) {
str = str.substring(1, str.length() - 1);
}
wnm3 commented
I have created release 2.2.7 to address this issue. I also added a test for finding Account.`Account Name`
in the BasicExpressionTests so we will continue to track this issue. If you agree the problem is fixed, please close this issue. The new jar should be in Maven Central in a couple of hours.
PraveenKumarPrecisely commented
Thanks @wnm3 (Nathaniel )
We are really happy with the prompt changes.