Store Json String to Entity

Store Json String to Entity

  

Hello,


I want to ask about how to store Json String to Database entity. This is my json string sample :

I want to store that json string into my entity. I tried using assign into my entity using structure and mapping after i deselerized. But i cant get that json string value. (sorry my english is bad)

 

Hi Bimo,

I'm not sure I understand your usecase (and I don't think it's due to your English, it's pretty good as far as I can see). WsProsesAmortisasiCicilan is a webservice? Is it SOAP or REST? What is its output? Why do you deserialize the JSON? What data do you want to store? Why do you want to store the JSON as-is?

Sorry for the questions back, but I need to know what you're trying to achieve in order to give you a suitable answer.

helo kilian,

yes thats right WsProsesAmortisasiCicilan is a webservice using SOAP. The output is like this 

and my goal is want to display that to list. But i just display one. so can you help me?

Hi Bimo,

You want to display the JSON as-is in a list? The conceptual problem is that it isn't a list - it's a JSON array, that you probably receive as a binary (or large text) from the SOAP webservice? So either you can deserialize the JSON and show the content in a table, or you can just show the entire SOAP webservice's output - but not in a table.

Alternatively, you can chop the JSON up yourself, the way you see fit, but I wouldn't recommend that...

I cant display result from JSON Deserialize to table. Can you help me if i want to store json array from my webservice into localstorage or database?

Solution

Hi Bimo,

This is Harlin from Perkasa (Outsystems Partner Indonesia).

We met before when I presented Outsystems in your office :)


To achieve your goals (store json to database entity):

1. You need to deserialize the json into correct data type.

Your json is an array of object.

So your data type should be list of record.


2. your json is now is in a local variable (list of record), you need to iterate (loop) each of record before saving to entity...

To iterate you need For-Each node, like in below picture.

After For-Each you can pass that JSON.List.Current.Record to Create<Entity> Action.

If you still need more helps, just mail me: harlin@ppu.co.id

I will gladly help.

Solution

Harlin Setiadarma wrote:

Hi Bimo,

This is Harlin from Perkasa (Outsystems Partner Indonesia).

We met before when I presented Outsystems in your office :)


To achieve your goals (store json to database entity):

1. You need to deserialize the json into correct data type.

Your json is an array of object.

So your data type should be list of record.


2. your json is now is in a local variable (list of record), you need to iterate (loop) each of record before saving to entity...

To iterate you need For-Each node, like in below picture.

After For-Each you can pass that JSON.List.Current.Record to Create<Entity> Action.

If you still need more helps, just mail me: harlin@ppu.co.id

I will gladly help.


Hi Harlin,


Thank you for the solution, and it works!!!!

Glad it works...

Can you mark my post as your Solution, it will help other helpful people looking for unanswered question to help...