PhilipCubix opened a new issue, #5858:
URL: https://github.com/apache/hop/issues/5858

   Hi,
   
   when letting Hop write the JSON Path expressions for the following snippet:
   
   `{
     "@odata.context": 
"https://api.businesscentral.dynamics.com/v2.0/example.onmicrosoft.com/Production/api/integrator/customer/v2.0/$metadata#companies()/purchaseLines",
     "value": [
       {
         "@odata.etag": "W/\"JzE5OzQ1MTg1MTk4MzM5Mjk4Mzc3NDQxOzAwOyc=\"",
         "documentType": "Invoice"
       }
     ],
     "@odata.nextLink": 
"https://api.businesscentral.dynamics.com/v2.0/example.onmicrosoft.com/Production/api/integrator/customer/v2.0/companies()/purchaseLines?aid=FIN&$skiptoken='Order','129947',40000"
   }`
   
   it writes `$['@odata.context']` and `$['@odata.nextLink']` instead of 
`$.['@odata.context']` and `$.['@odata.nextLink']` (note the '.' after the 
dollar sign).
   
   These expressions seem to work when tested on [jsonpath.com](url), but they 
do not work in Hop. They result in NULL when left unchanged.
   
   The problem is solved by adding a period after the dollar sign, just in 
front of the square brackets.
   
   The code that decides whether to write a period OR wrap the field name in 
brackets is here:
   
   
https://github.com/apache/hop/blob/aa2b439482e4a61a26d8bf82f9785f1600132e81/plugins/transforms/json/src/main/java/org/apache/hop/pipeline/transforms/jsoninput/JsonInputDialog.java#L1537
   
   If a period would be written AND the field name would be wrapped in 
brackets, the JSON path expression would work. This seems to me to be the 
simplest solution...
   
   (The other solution would be to look into the parser that is used at run 
time)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to