@@ -26,17 +26,22 @@ public type JsonPathRawTemplate object {
26
26
};
27
27
28
28
# Extract details from the given JSON value using the provided query template expression
29
+ #
30
+ # ```ballerina
31
+ # read({id: 1, "name": "John Doe"}, `$.name`) => "John Doe"
32
+ # ```
33
+ #
29
34
# + 'json - JSON value
30
35
# + query - JSON path expression
31
36
# + return - extracted details as JSON value, a jsonpath:Error otherwise
32
37
public isolated function read(json 'json , JsonPathRawTemplate query ) returns json | Error {
33
38
return readJson ('json , new JsonPathRawTemplateImpl (query ));
34
39
}
35
40
36
- public class JsonPathRawTemplateImpl {
41
+ class JsonPathRawTemplateImpl {
37
42
* JsonPathRawTemplate ;
38
43
39
- public isolated function init(JsonPathRawTemplate jsonPathRawTemplate ) {
44
+ isolated function init(JsonPathRawTemplate jsonPathRawTemplate ) {
40
45
self .strings = jsonPathRawTemplate .strings ;
41
46
self .insertions = jsonPathRawTemplate .insertions ;
42
47
}
@@ -46,6 +51,6 @@ public class JsonPathRawTemplateImpl {
46
51
# + 'json - JSON value
47
52
# + query - JSON path expression
48
53
# + return - extracted details as JSON value, a jsonpath:Error otherwise
49
- public isolated function readJson(json 'json , JsonPathRawTemplateImpl query ) returns json | Error = @java :Method {
54
+ isolated function readJson(json 'json , JsonPathRawTemplateImpl query ) returns json | Error = @java :Method {
50
55
'class : " io.ballerina.lib.data.jsonpath.BJsonPath"
51
56
} external ;
0 commit comments