-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved jsonpath jsonb support, for issue #2138
- Loading branch information
Showing
2 changed files
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
core/src/test/java/com/alibaba/fastjson2/issues_2100/Issue2138.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.alibaba.fastjson2.issues_2100; | ||
|
||
import com.alibaba.fastjson2.JSONObject; | ||
import com.alibaba.fastjson2.JSONPath; | ||
import com.alibaba.fastjson2.JSONReader; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class Issue2138 { | ||
@Test | ||
public void test() { | ||
JSONObject jsonObject = JSONObject.of("name", "charmander", "age", 18, "birthday", "2000-01-01"); | ||
byte[] jsonbBytes = jsonObject.toJSONBBytes(); | ||
JSONPath path = JSONPath.of("$.name"); | ||
path.extract(JSONReader.ofJSONB(jsonbBytes)); | ||
} | ||
} |