web_reg_save_param_json retruns string not found

VUGEN version: 2023 R1 build 251

Protocol: HTTP/HTML using C

I'm trying to get values based a condition that a specific property doesn't exist. The query works in online tools like https://jsonpath.com/ but the same query is not working in VUGEN.

Example:

{
"data": {
"items": [
{
"status": "SUCCESS",
"id": "2edxxxx-18cd-4afd-587d-08dcbe08bd22"
},
{
"status": "SUCCESS",
"filePath": "xyz",
"id": "101xxxx-3719-4c18-15cc-08dcbc8db422"
}
]
},
"statusCode": 200
}


I need to get the value of id if the filePath property doesn't exist. The queries that I used is below. both are working in online tools.

$.data.items[?(!@.filePath)].id
$.data.items[?(@.filePath==null)].id


Action.c(17): Error: No matches were found for the specified query: "$.data.items[?(!@.filePath).id".
Action.c(17): Error: lr_json_find failed

I tried using both  lr_json_find and web_reg_save_param_json, no luck.

Is there an updated jsonparser.dll that handle these types of queries?

  • Suggested Answer

    0  

    , The ! expression-operator does also not work in LRE 2024.3. According documentation of LRE web_reg_save_param_json, the JSON-Path expressions should follow JsonPath on Githup. This page does not list the negation operator, so it is in line with documentation, but other, listed operators also fail.

    Note that there are many JSON path expression standards so it is hard. You might see if there is already an JSON Path topic in the Idea Exchange and vote for it, or create a new one.

    For your situation you need some extra code to figure it all out unfortunate. You might use lr_json_delete() to remove the entries with filePath...

    Success, Erik

    How to ask questions

    Reward contributions via likes or 'verified answers'