New Layout: Using API, fields are retrieved in different order

  • Roberto
    Asked on January 3, 2018 at 5:38 AM

    Hello,
    using this API

    GET / form / {id} / questions

    the JSON structure of the answers does not respect the order in which they were constructed and displayed online.

    I Created

    1) Name and Surname

    2) Email

    I get

    1) Name and Surname

    2) Address


    The link of the form: https://form.jotformeu.com/72691676319367

    the JSON answer
    {
        "id": "3907248464889084633",
        "form_id": "72691676319367",
        "ip": "82.59.128.84",
        "created_at": "2018-01-02 12:54:07",
        "status": "ACTIVE",
        "new": "0",
        "flag": "0",
        "updated_at": "2018-01-02 12:54:30",
        "answers": {
          "2": {
            "name": "datiGenitoreINPS",
            "text": "Dati genitore",
            "type": "control_fullname",
            "answer": {
              "first": "MARIO",
              "last": "ROSSI"
            },
            "prettyFormat": "MARIO ROSSI"
          },
          "3": {
            "name": "indirizzoGenitoreINPS",
            "text": "Indirizzo",
            "type": "control_address",
            "answer": {
              "addr_line1": "Via Milano, 51",
              "addr_line2": "",
              "city": "ROMA",
              "state": "",
              "postal": "00100",
              "country": ""
            },
            "prettyFormat": "Indirizzo: Via Milano, 51<br>Città: ROMA<br>Codice Postale: 00100<br>"
          },

    Jotform Thread 1337233 Screenshot
  • Adrian
    Replied on January 3, 2018 at 7:12 AM

    Can you please give us more information.

    Did you make any recent changes on your form? Also what Library are you using?

  • JFRoberto
    Replied on January 3, 2018 at 9:16 AM

    Hi Adrian

    I realized the form and then I have added other controls.

    I invoke the API using c#.

    The problem is that the number of the items in the Json parts "answers" is not the same of what is displayed on line.

  • Kevin Support Team Lead
    Replied on January 3, 2018 at 11:07 AM

    I have been testing this and I can see what you're reporting, but the thing seems to be related to the fields of the form, I will forward it to our second level so this can be checked, as far as I know the fields should appear in the same order on both ends, the API calls as well as the builder. 

    We will keep you updated via this thread. 


  • NeilVicente
    Replied on January 7, 2018 at 12:32 AM

    Form questions returned via the API are ordered chronologically, i.e., by the time each question was added to the form.

    To get the correct order by which the questions are displayed on the form, simply refer to the "order" property of the question object.

    New Layout: Using API, fields are retrieved in different order Image 10

    Hope this answers your question.

    Cheers!

  • NeilVicente
    Replied on January 7, 2018 at 12:42 AM

    As for submissions, you can always refer to the QID property (the index of the answers object) and rearrange it programatically.