Replicating Curl call with POST KNIME node

Hi Everyone,

Thanks for taking a look!

I’m trying to replicate the following Curl command using the post KNIME node.

 curl -H "X-CDD-Token:$TOKEN" --form-string 'json={"project": "34888", "autoreject":"false", "mapping_template": "36708","runs":[{"run_date": "2017-05-26","place": "basement lab"}, {"run_date": "2017-05-28","person":"Lab assistant"}]}' -F 'file=@path/to/file.csv' ''

I’ve used the GET node to get the project and mapping template information and I’m trying to build the JSON body.

The issue I’m finding is when I’m trying to build the following:

“runs”:[{“run_date”: “2017-05-26”,

I’m capturing the date from the filename and trying to build the string using both java snippet or column combiner. They both result in the same issue when the string is passed into the table to JSON it shows the “escapes” for the double quotes I used to build the string.

I’ve attached a workflow that illustrates this issue. Any ideas would be very much appreciated!


table_to_JSON_JMO.knwf (15.4 KB)

Hi @j_ochoada ,

I’m not a coder but because my current project requires me to identify particular string values from a Get-Request for content extraction purposes, the pattern I’m seeing from your JSON output resembles what I recently saw with the raw data I was working on. When I saw your post, I decided this is interesting to learn more and I did some Googling, which leads me to this link with the following comments:

The code to add slash before the double quotes was probably done to comply to the specifications set out in and RFC 8259 (RFC 8259 - The JavaScript Object Notation (JSON) Data Interchange Format) to allow for double quotation marks as part of a string value in the name:value pair.

If you want to get rid of the backslash, I have tried experimenting the possible scripts, and here’s your option with a String Manipulation Node:

replaceChars($column1 (1-WORD_NGRAMS, language=ENGLISH)$,"\","")

Here’s to demonstrate what it does:


I experiment with this for my own learning purpose. Not sure if it applies to your case. But if the script helps you out, I’ll be glad.

PS. For the script I showed, you’ll have to replace the column name with your own, in between the two $ symbols.

1 Like

Hi @badger101

Thanks for taking a look at this. Interesting link that makes me think that the backslashes are OK maybe? I tried your snippet in string manipulation but it failed as it was written for me. To get it to work I needed to use replaceChars($runs$,"\" ,"" ) with a second backslash where I escaped the backslash. I’m noticing as I type this that the second backslash doesn’t show in the post.


But that did not actually remove the backslashes from the output of the JSON. It does remove backslashes which are explicit in the table like shown in test and new column.

But it does not remove the apparently hidden backslashes in the runs column. And that propagates through to the JSON output.


Interesting behavior but like your link seems to indicate maybe it’s OK to send the call that way.

Thanks again!

I will also add that this seems to be a question that pops up once in a while. Some links say that the backslash is not a real character if you do a character count.

I also found a link which validates JSON and when I paste in my JSON it says it’s OK but if I take out the backslashes it is invalid.

Hope this helps others!


Indeed that’s so interesting!

1 Like

OK after additional work it appears that the JSON is just fine. The issue is with the file I’m trying to send along with the post request. It is being sent as binary object and the error says Illegal parameters binary object.


1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.