Support Questions
Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

Nifi - Getting JSON parse exception while making a curl call to rest api


I am using execute stream command processor to make a curl call to rest api and getting below json parse exception.




Curl Call: (below command was extracted into a variable called curlcommand as mentioned in the screenshot)

--location;--request;POST;"";--header;${content_type};-d;"[{"bin": "02608","groupId": "52821094"},{"bin": "02609","groupId": "528212387"}]"



{"timestamp":1580154052402,"status":400,"error":"Bad Request","message":"JSON parse error: Unexpected character ('b' (code 98)): was expecting double-quote to start field name; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('b' (code 98)): was expecting double-quote to start field name\n at [Source: (PushbackInputStream); line: 1, column: 2] (through reference chain: java.util.ArrayList[0])","path":"/data"}


Please help..


Super Mentor


What is your NiFi Version?


Looks like there is already a similar JIRA [1]  Which seems to be addressing this behaviour of "ExecuteStreamCommand" in the NiFi version "1.10.0".

[1] ExecuteStreamCommand filters out any double quotes when parsing the "Command Arguments"


@jsensharma Thanks for your response.

We are using 1.7.

I changed ExecuteStreamCommand to InvokeHTTP processor.

Escape the "s in the json data object:


"[{\"bin\": \"02608\",\"groupId\": \"52821094\"},{\"bin\": \"02609\",\"groupId\": \"528212387\"}]"


Let us know if this works, and if it does please accept this answer.


Thanks @stevenmatison.

I tried escape "s and still it is failing.

@VijaySankar  did you get it solved?