Hey,
I am using JSON Deserialize.
I just created the structure based on the output. It automatically created with the following
But the results are not assigning exactly.
I tried Deserialize online and got this format.
[
{
"productId":"xxxxxxxxxx",
"title":"Elite Plan (xxxxx)",
"description":"Access to all elite features (test)",
"price":"? 50.00",
"currency":"INR",
"priceAsDecimal":50
}
]
How to define this in outsystems?
Hi Keerthi,
your structure looks fine.
I think the problem is that your JSON is an array (of 1), so your Data Type property on the JSONDeserialize shoud be ProductData List instead of ProductData
have a try and let us know if that solved it,
Dorine
Dorine Boudry wrote:
Yes , It worked.
I need another suggestion from you.
I need to pass a parameter value like this
.getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...])
How can i pass array of values in input parameter?
Thanks in advance
Keerthi Vasan wrote:
Hi Keerthi,You need remove the [ and ] characters.Like this:Thanks
Pedro Costa wrote:
How to remove that [ ], Its coming from my script output
I don't really know enough about what you are trying to do, pass if from where to where ?
The structure in Outsystems that functions as an array is a List. If you need to pass the parameter into or out of an Action, you could use a list.
If you need to pass an group of several items into a screen, or I think in your case out of a javascript node, I don't think you have the option of using a list, so you'd have to resort to for example a JSON string.
Good luck,
Hey Dornie,
I am trying to pass values dynamically to a script Input,
This is the action i am trying to use,
inAppPurchase .getProducts(['com.yourapp.prod1', 'com.yourapp.prod2', ...]) .then(function (products) { console.log(products); /* [{ productId: 'com.yourapp.prod1', 'title': '...', description: '...', currency: '...', price: '...', priceAsDecimal: '...' }, ...] */ }) .catch(function (err) { console.log(err); });
in the script i have added like this
inAppPurchase.getProducts(['XXXXXXXXXX', 'XXXXXXXXXXXX']) .then( function (products) { console.log(products); $parameters.IsError = false; $parameters.ErrorMessage = ''; $parameters.Products = JSON.stringify(products); $resolve(); } ) .catch( function (err) { console.log(err); $parameters.IsError =true; $parameters.Products=''; $parameters.ErrorMessage = err; $resolve(); } );
Now my need is to use a input paramter to pass the values dynamically,
inAppPurchase.getProducts([$parameters.ProductId ])
this is working for a single value.
if i need to pass list of arrays like the following
['com.yourapp.prod1', 'com.yourapp.prod2', ...]
How should i need to implement?