cancel
Showing results for 
Search instead for 
Did you mean: 

Rest JSON deserialization converted to key=value

esseti
Champ in-the-making
Champ in-the-making
Hi all.
i've a problem with the rest functions, especially the start one.
i send data in this way:

{
   "processDefinitionKey":"sid-f7f670e1-a6cf-42a7-b824-f88446256b7f",
   "variables":[
      {
         "name":"processId",
         "value":108
      },
      {
         "name":"data",
         "value":[
            {
               "lastname":"my lastname",
               "birthday":"my birthday",
               "name":"my name"
            }
         ]
      },
      {
         "name":"task_instance",
         "value":82
      }
   ]
}

now, inside one of my task i load the "data", but what i get is this:

[{lastname=my lastname, birthday=my birthday, name=my name}]

that's wrong.

how can i solve this problem?
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
What a coincidence, I have a blog-post about this ready and will be posted today. I'll post the link here once it's online!

esseti
Champ in-the-making
Champ in-the-making
i found that it is already parsed. so i've to encode it twice to do the parsing manually.

frederikherema1
Star Contributor
Star Contributor
Yes, it's parsed into a Map by Jackson…

esseti
Champ in-the-making
Champ in-the-making
mmm.
another thing.
i'm trying to write a script to manipluate a json object with groovy and script task.
this is the object (it's "data", an execution variable):

[{"validation": "7"}, {"validation": "5"}]
when i try to check the lenght, it gives me this:

size 42
basically it's understood as a string and not as a json list.

any idea?

frederikherema1
Star Contributor
Star Contributor
How is the variable stored in the process (which type)? Check the ACT_RU_VARIABLE or use the API to fetch the variable value yourself (not in a script)…

esseti
Champ in-the-making
Champ in-the-making
The fact is that by sending a singal i can only send a string (or other first-class types).
Probably also for the start process i can't send json objects (i actually send a string). but there i've a java class that does the translation, and it stores a JSONObject with setVariable.
The problem is with signals. I can't make it receiving a json object. I tried and i seen them as "null" in a script task.
Right now I made a compiler that takes the process and adds a service task after each receive.
i've to test it. wondering if there's a better solution. but if it works than fine (i've to compile the process anyway).
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.