Forum Discussion

JessicaFeauto's avatar
JessicaFeauto
Qrew Member
3 days ago

Make Request JSON returning blank when only one record returned

I am retrieving data from an external data source using Make Request.  I am then using another Make Request to send data to a QB table using the format shown below. It works great when I have 2 or more records in the response.  However, when I only have one, then every field ends up being blank, even though I can see data in the response.  Any thoughts?

 

{# create records in XXXX table #}
  "to": "XXXXX",
  "data": [
  {% for rec in f.json.response.xxxxxs.xxxx %}
  {% if loop.index0<5800 %}
    {
            "12":{ "value": "{{rec['@creationdate']}}"},  
             "6":{ "value": "{{rec['@id']}}"},   
            "38":{ "value": "{{rec['@status']}}"}


    }
 {{ ", " if not loop.last else "" }}
 {% endif %}
    {% endfor %}

  ]
}

 

  • DonLarson's avatar
    DonLarson
    Qrew Commander

    I am just guessing here. In line 5 is the spacing and syntax correct ?  I am no JSON expert but I vaguely remember something about the index needing to be in brackets.    Something like

    loop.index.[0] 

    Hopefully somebody else will weigh in here for you.