Skip to main content
Solved

Proces nested json with task through indicium


Blommetje
Forum|alt.badge.img+13

Hi,

I’m trying the following. I have a task that inserts a row in a table ‘input_json’. This task is called as an endpoint, so a supplier can insert some data. The task works, but I have two issues; 

The JSON: 

{
    "id": 123456789,
    "package-id": "",
    "timestamp": 1718105305,
    "location": "Rotterdam",
    "measurements": {
        "dimensions": {
            "height": 100.0,
            "width": 100.0, 
            "depth": 100.0},
        "weight": 100.00
    }
}

My task fails to read the nested values. When I remove the nesting from the JSON and post, it works ok. How can this be mapped accordingly? 

Secondly, the key ‘package-id’ has a score. SF always change my score (-) in the task parameter to a lower score, resulting that the value isn’t saved.

How can these two issues be resolved?

Thanks and kind regards!

Blommetje

Best answer by Mark Jongeling

I’m not entirely sure the platform can handle nested JSON structures like this one, but you can always use the method of having one task parmeter that contains all JSON data, and thereafter parse and process it via logic.

Secondly, the key ‘package-id’ has a score. SF always change my score (-) in the task parameter to a lower score, resulting that the value isn’t saved

The platform does not allow - but rather converts that to _, that is the intended behavior. The method above can circumvent that. Maybe other Community members can chime in.

View original
This topic has been closed for comments

Blommetje
Forum|alt.badge.img+13

Any thoughts on this?


Mark Jongeling
Administrator
Forum|alt.badge.img+23

I’m not entirely sure the platform can handle nested JSON structures like this one, but you can always use the method of having one task parmeter that contains all JSON data, and thereafter parse and process it via logic.

Secondly, the key ‘package-id’ has a score. SF always change my score (-) in the task parameter to a lower score, resulting that the value isn’t saved

The platform does not allow - but rather converts that to _, that is the intended behavior. The method above can circumvent that. Maybe other Community members can chime in.


Blommetje
Forum|alt.badge.img+13

Hi Mark, 

Yes, that would also be a good solution. I've tried this, but so far I've not got the entire JSON data. 
How can I create a parameter that will 'accept’ all data? 

Thanks! 

Blommetje


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hey, 

You could also opt to use a subroutine with API option on. That will make it available via the API through POST as described here: OData API | Thinkwise Documentation (thinkwisesoftware.com)

Have one subroutine parameter called input_data for instance. The caller enters the (escaped) JSON data in this parameter. After that, the subroutine can process the received data.

Hope this helps!


Blommetje
Forum|alt.badge.img+13

Hi,

I've asked my client to flatten their JSON, so I can process accordingly. I'm surprised nested json isn't supported to be honest. 

Grabbing ALL data in one go could be nice, but also requires the client to adjust their json. Now it was not a big problem, but sometimes it's not possible. 

Are there are plans on supporting this in the future? 

Blommetje 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings