Forum Discussion

AddieBrunson's avatar
AddieBrunson
Qrew Member
3 years ago

JSON Fetch > Iterate over JSON Records > Create Records

I'm having issues getting a pipeline to add records for each JSON object. I think it has to do with the JSON schema example in the Iterate over JSON records step, but I've tried a few different options without success. Here's what I'm looking at:

Below is an example of the data from a user data call. This has 2 employee objects (or arrays? I'm not sure...) I'd like to create a record for each employee, pulling their email address from the data into a field. When I enter the example below in the JSON Schema Sample and run the pipeline, I get only a record created for employee 1.

I've tried altering the JSON schema sample to what's shown below. When I take this approach, I get a record created, but it is completely blank (no email). 

Any help would be much appreciated!

------------------------------
Addie Brunson
------------------------------
  • DougHenning1's avatar
    DougHenning1
    Community Manager
    Hi Addie,

    The JSON schema sample should only contain the schema for a single record structure.  The purpose of the schema is to help you reference the fields for drag and drop in later steps. So in your case, you can use this for a schema:

    {
    "id": 0,
    "first_name": "",
    "last_name": "",
    "email": "",
    "location": "",
    "employee_id": "",
    "is_active": true,
    "company_groups_ids": [ "", "" ]
    }

    The values don't have to be populated with real data, but the value defines the field type (e.g. "" for a text field, true or false for boolean, etc.)

    Then you should see the fields specified in the schema in following steps to create new records:

    Hope that helps!

    ------------------------------
    Doug Henning
    ------------------------------
    • AddieBrunson's avatar
      AddieBrunson
      Qrew Member
      Hi Doug, 

      Thanks for the quick reply! I changed the schema with your recommendation, but still getting 1 record created that is completely blank. Below is what I'm getting when running the pipeline. The pipeline is also going idle after a few seconds...



      ------------------------------
      Addie Brunson
      ------------------------------
      • DougHenning1's avatar
        DougHenning1
        Community Manager
        Forgot to mention you need to set the records path.  The list of objects is in /results so put that in the JSON Records Path



        ------------------------------
        Doug Henning
        ------------------------------