Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
bug fixed for jsonpath, for issue #2306
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Apr 11, 2019
1 parent 6ee3f8e commit af75710
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/alibaba/fastjson/JSONPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,13 @@ Object parseArrayAccessFilter(boolean acceptBracket) {
}

int start = pos - 1;
char startCh = ch;
while (ch != ']' && ch != '/' && !isEOF()) {
if (ch == '.' //
&& (!predicateFlag) //
&& !predicateFlag) {
&& !predicateFlag
&& startCh != '\''
) {
break;
}

Expand Down
16 changes: 16 additions & 0 deletions src/test/java/com/alibaba/json/bvt/issue_2300/Issue2306.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.alibaba.json.bvt.issue_2300;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import junit.framework.TestCase;

public class Issue2306 extends TestCase {
public void test_for_issue() throws Exception {
JSONObject object = new JSONObject();
object.put("help_score_avg.cbm", 123);

assertEquals(123
, JSONPath.extract(
object.toJSONString(), "['help_score_avg.cbm']"));
}
}

0 comments on commit af75710

Please sign in to comment.