Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Use string date in JSON struct - JIRA SIL

Edited

Hi everyone.
I've got a problem with a struct for JSON in SIL script.
To read JSON via httpGet() from http://{my.jira}/rest/tempo-core/1/holidayscheme/{id}/days/floating i need structrure like this : 


struct HolidayDay
{
  number id;
  number schemeId;
  string name;
  string description;
  string duration;
  string type;
  string date;
}


but I have an error on the line : string date;, becouse date is one of internal type in SIL.
When I rename string name to string name_,  httpGet doesn't read this property.


I need some solution how to read this properly.

 

 

2 answers

1 accepted

0 votes
Answer accepted

Hi,

First, thank you for pointing this out for us, having a field with the same name as a SIL reserved keyword is indeed a limitation that we didn't consider.

We are going to fix this. However, in order to have better visibility of the process, I would kindly advise you to also create a ticket with this issue in our Service Desk support portal: https://jira.cprime.io/servicedesk/customer/portal/2

This way you will also be able to receive the quick fix before our next official release.

Best Regards,

Cristian Pintea

2 votes
Jonathan Muse _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 06, 2018

Hi @f2997042, while we work on fixing this bug you can try a workaround like this:

struct HolidayDay
{
number id;
number schemeId;
string name_;
string description;
string duration;
string type;
string date_;
}

HolidayDay hd;
hd.id = 1;
hd.schemeId = 123;
hd.name_ = "Name";
hd.description = "Test";
hd.duration = "24h";
hd.type = "Test";
hd.date_ = "06/12/2018";

string json = toJson(hd);

json = replace(json, "name_", "name");
json = replace(json, "date_", "date");

 

httpGet(requestURL, request, json);

Was there ever a more permanent solution provided to this?  Or is this still the accepted workaround?

Jonathan Muse _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 30, 2022

Hi @Jon Kovalik we were able to fix some of the occurrences like this. For example, "name" could work in the regular manner now. However, we were not able to fix reserved words like "date" because it is a variable type and we couldn't have it work different ways in essentially the same scenario.

Jonathan Muse _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 30, 2022

We do have a long-term solution on the roadmap that would let you parse the JSON without defining it as a struct first. I think ultimately this will be the ideal solution.

I'm trying to parse a field called "date" and the workaround noted above was not working for me.  I'm not sure what my options are at this point to be able to read in that field.  Thoughts?

@Jonathan Muse _Appfire_ - can you define how far out the "long-term solution" would be?  The inability to parse a field called date is going to be a headache for us as our initial use case falls into this category.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events