but that doesnt work, it somehow sees the first brackets and interacts with the “rawtext”
argh!!
is there any way I can get around this? I need to be able to feed expressions within this json object. Please help me!
2. then create a json object (no idea if thats the name), by putting this expression into the next set node between the curly brackets. Which is basically the same as doing it directly at step 1, and thus doesnt work.
@bees8 I am very sorry but I am not sure I follow. Can you please post a simple workflow example of what you want to achieve and the how exactly the data in a certain parameter should look like. I can then have a look.
this finally works, thanks @jan ! I’m almost there!
I managed to get almost all the expression included, except for one.
it is an array, and one that I want to be optional, that’s why I have formatted the expression as the following:
As you can see, this doesn’t really work out. ( for clarity, I have added the second example to show that the entire expression works fine without the verAttributes expression.
My thought was that it is probably parsed as a string, so instead of
, "array": [{"key1":"value1","key2":"value2"}]
if will most likely show up as: , \"array\": [{\"key1\":\"value1\",\"key2\":\"value2\"}]
which is of course not a valid json format
@jan is there an opposite of your json.stringify function? Maybe that will work?
I have also tried parsing only key1 and value1, but that will not work because if they do not get parsed (because optional), I’m stuck with invalid json.
Theoretically should you be able to set it exactly the same way as the others. If it exists it will set it, if not then undefined will be returned and should so not show up.
oh that is so cool!
Learnt a lot from this thread, thanks @jan !
In the end, I settled with a compromise though. It was great that undefined doesnt show up and in the above case it would be perfect, though late last night I found out my array wasn’t right, it actually has two key/value sets of which one is a variable, and the other not. So because one of them is fixed, it will always output an array. Anyways, all details, potato potato.
In the end the most important thing is that it is working now splendidly!
Thanks so much everyone! I can finally get some sleep
**Lessons learnt: ** 1. Don’t put expressions between curly brackets if they are already between curly brackets. 2. don’t put expressions between " these apostrophes " 3. if the value of a key/value pair is an expression and it is not valid, the key also will not show up, ensuring the json still stays valid
Ps. Could you tell me what you did not understand on my first response as this is the same as the marked solution? Want to improve my answers so less people get bald.
Hey @BramKn - absolutely!
If you look at my first example and the lessons learnt, it was basically point 2. Your suggestions was entirely correct, though it needed some contect (doesnt work within apostrophes). @jan’s reply helped me because I decided to follow the example directly (I pasted it under my line, and it allowed me to check character for character). Thanks for your input!!