Skip to main content
Question

Dynamic list attribute to JSON Response format


bhanu_v
Forum|alt.badge.img

I'm trying to read select multiple survey123 form responses dynamically to create a JSON template. The number of selections from a list of 24 values of tree diseases is in the survey, The feature service captures these multiple responses as comma-separated values. each comma-separated value is represented in JSON format for the HTTP caller to make an API request.

each disease type has a unique answerID

How to dynamically create JSON template from the number of list elements in the attribute splitter

6 replies

takashi.pss
Contributor
Forum|alt.badge.img+3
  • Contributor
  • April 17, 2021

Do you need to create a JSON document (middle image) based on the list attribute "_treediseaseList" (left image)?

If so, where the IDs (AnswerID, InspectionID, QuestionID) corresponding to each AnswerValue (disease name) are come from?


bhanu_v
Forum|alt.badge.img
  • Author
  • April 19, 2021
takashi.pss wrote:

Do you need to create a JSON document (middle image) based on the list attribute "_treediseaseList" (left image)?

If so, where the IDs (AnswerID, InspectionID, QuestionID) corresponding to each AnswerValue (disease name) are come from?

Hello @Takashi Iijima​ ,

I'm populating a Cityworks Inspection Template based on these values, In the template, each question and answer option have ID's

If it was select one question I use an attribute creator and JSON Templater to make up the JSON for the request. For a select multiple there is no way to know ahead how many of these list items will be selected. The Inspection ID comes from the HTTPCaller response body which I extract using a JSON Extractor.CityworksObservationQuestionQuestionAnswerID


takashi
Influencer
  • April 19, 2021

I think the first screenshot in your question is the source table which you need to convert to a JSON document, and I guess that the source table contains some attributes storing the IDs (question ID etc.), similar to the attribute called "treedisease" storing comma-separated tree disease names.

If so, could please share the source table?


bhanu_v
Forum|alt.badge.img
  • Author
  • April 20, 2021
takashi wrote:

I think the first screenshot in your question is the source table which you need to convert to a JSON document, and I guess that the source table contains some attributes storing the IDs (question ID etc.), similar to the attribute called "treedisease" storing comma-separated tree disease names.

If so, could please share the source table?

Hello @Takashi Iijima​ 

please find the excel containing the QuestionID and AnswerID,attached here

Thankyou


bhanu_v
Forum|alt.badge.img
  • Author
  • April 20, 2021
bhanu_v wrote:

Hello @Takashi Iijima​ 

please find the excel containing the QuestionID and AnswerID,attached here

Thankyou

This is the correct table


takashi
Influencer
  • April 20, 2021
bhanu_v wrote:

Hello @Takashi Iijima​ 

please find the excel containing the QuestionID and AnswerID,attached here

Thankyou

The attached workspace demonstrates how you can translate the Excel table to a JSON array.jsontempater-example


Reply


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