If I am not mistaken It basically means that in case sender of a REST message cant for some reason Escape a JSON then the only other option is to store a payload in a file and afterwards read payload as SPIN.
@StephenOTT thx for the suggestion.
I have been reading a lot about spin/josn today as I am still a newbie here. But I cant still find a way how to convert let say a string which came via REST with more than 4000 characters to json/spin, so I can meaningfully work with it.
In your output parameter in your HTTP-Connector configuration set the type of Script and use Javascript: Then execute the script from above.
Then you can save your SPIN. So something like
var mySpin = S(JSON.stringify(response))
execution.setVariable('myResponse', mySpin)
Then when you get that variable somewhere else like in a expression or other scripts you can do
expression example:
${myResponse.prop('myKey').value()}
assuming your json looks like
{
"myKey": "myValue"
}
then the expression would eval to a value of myValue.
@StephenOTT
I have tried many things and got diffrent resulte
but the last one is
Could not apply modification :
Unable to evaluate script: ReferenceError: “execution” is not defined in at line number 2
sorry for bringing this up again and again
basically what I did is
I did successfully import big chunk of json via rest http connector but not stringified
in case I try to stringify I immediately get some kind of errors like
var mySpin = S(JSON.stringify(response));
connector.setVariable(‘var1’, mySpin)
gives
java.util.TreeMap cannot be cast to java.lang.String
or
SPIN-01004 No matching data format detected
change of json array to just plain json {}
var mySpin = JSON.stringify(response);
connector.setVariable('holidays3 ', mySpin)
ENGINE-03083 Exception while executing Batch Database Operations with message ’
org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance
(batch index #1) failed.
Cause: java.sql.BatchUpdateException: Data truncation: Data too long for column ‘TEXT_’
what do I aim is to do some jsonpath very similiary like
but it seems it wouldnt be possible without stringify… then elements…
Strings have a limit in the database of 4000 characters.
YOu need to keep your object as a SPIN JSON which will be stored as a object/byte array/blob and therefore not have the limit of the 4000 characters.
When you stringify you should only be doing this in-memory/within the script or when you need to same more simple data (within 4k characters)
It is not that I want to work with JSON as a string.
What do I aim is to work with JSON using tools like jsonpath, ( elements) .
Which basically means to do it in-memory, if I am not mistaken