Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
6 replies
Subscribers
9 subscribers
Views
3205 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I have a json output from a http service coming like this. "mes
nitas811
over 10 years ago
I have a json output from a http service coming like this.
"message":{
"validation_errors":"True",
"error_data":{
"push_qa_contact_phone":[
"Missing data"
],
"push_dev_contact":[
"Missing data"
],
"component":[
"The Component in your JIRA Ticket is not eligible for OpenWindow."
],
"push_dev_contact_phone":[
"Missing data"
],
"push_qa_contact":[
"Missing data"
]
}
},
I would like to get all the keys under error_data, the keys could keep changing in output how do I get all the keys in this output and parse through each one of them?
OriginalPostID-147661
OriginalPostID-147661
Discussion posts and replies are publicly visible
0
Tim
Certified Lead Developer
over 10 years ago
Although the error_data could be different for each response from the service is there a finite number of possible keys? I'm assuming the errors are defined by the service provider? The a!fromJson() function will help and you would be able to loop through the possible error responses.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nitas811
over 10 years ago
I could get the length of error_data by putting it in array variable. I do not see this function fromJson under functions. We are at version 7.2 is that a new version function. With that function can we get the keys for a json and parse through it?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 10 years ago
Unfortunately in the older versions of Appian there was no native way to parse Json. Previously a shared component was available that had json parsing functions but it was removed following the introduction of a!toJson and a!fromJson functions. You can speak to your AE or PS to try and get this old plugin but I would recommend upgrading your system as so much new functionality is now available.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nitas811
over 10 years ago
We are in middle of upgrading to latest version. So just to confirm in 7.8 we don't need keys to get the values, we can get the values without knowing what the keys will be?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 10 years ago
No you will need to know the keys to be able to query the data. The function a!fromJson() will put the data into a dictionary syntax which will make it easier to parse. I also asked if there is a finite list of possible error keys? If so you could create a constant to hold that full array (i.e. push_qa_contact_phone, push_dev_contact etc) and then on each response you could loop over the returned values and use the index() or property() functions to retrieve the values per key
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nitas811
over 10 years ago
Yes we do have a finite set of possible keys but was trying to avoid hardcoding through it and retrieving values for each of the keys if they exists. That was my initial question. Is that going to be possible?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel