I am trying to build a POST request body using string manipulation as I need the body to change with other fields’ values. I cannot figure out how to concatenate " with other fields values I keep getting syntax errors?
trying to build something like the below where the numbers change to a latitude and longitude. Any ideas for the double quotes?
I think you may need to provide your source data table (or equivalent example) and the JSON body you want to end up with so that someone can help. It’s not 100% clear what you want to do here. I work with JSON quite a bit in my apps, so I may be able to help with a clearer definition.
String manipulation node is a last resort with JSON bodies - you should be able to get what you need from a series of Table to JSON nodes. It’s tricky at first, but most things are possible.
If you just need to remove the quotes from the JSON above, then you can use the string manipulation node. Just use the replace function with a blank as replacement. But I am fairly sure this won’t solve all your issues.
So you are trying to build a POST request in some kind of a loop? I assume you are using flow variables for that purpose as well? If so topic where String Manipulation was used to build a complex query can help:
Not going to lie I’m a novice on knime and completely self taught so I have yet to go into flow variables. But correct I am trying to build a post request body for each row of data and make individual requests.
I will have a look at what you suggested I tried using just the standard string manipulation but couldn’t work out how to concat double quotes onto strings/ fields using the join function
I see. No problem. We all learn. So to have quotes you need to use escape character before them and that is backslash so something like this: join("\"This is a string with quotes around it\"","Another string")