Flattening Nested JSON on Intake

Example of Flattening Nested JSON on Intake

New in Release 1.1: Nested JSON will be automatically parsed out at Intake. This will allow you to map each value separately. Here is an example of how that would look like.

Say you're generating leads on an app and you're having customers enter their information into very long forms. In order to make things convenient for your application, you decide to group similar information together using Nested JSON (grouping Address, City, State, etc). Here is an example of how that would look like: (Example using Javascript in the browser)

fetch('https://api.belunar.com/shuttle/intake', {
            body: JSON.stringify({
              api_key: '897dc5e9-ee3f-4ead-9d43-f0f2f3ab5c08',
              Vertical: 'Mortgage',
              FormData: {
                Address: {
                  StreetAddress: '123 Hollywood Blvd',
                  City: 'Los Angeles',
                  State: 'CA',
                  ZipCode: 11111,
                },
                Phone: {
                  Home: '202-555-0148',
                  Work: '202-555-0171',
                },
                Email: 'jdoe@email.com',
                'First Name': 'Jane',
                'Last Name': 'Doe',
                Home: {
                  HomeType: 'Residential',
                  TypeOfRate: 'Fixed',
                  CreditRating: 'Good',
                  Loan: {
                    LoanAmount: '$300,000',
                    LoanInterestRate: '5.0%',
                    LoanTerm: '30 years',
                  },
                },
              },
            }),
            headers: {
              'Content-Type': 'application/json',
            },
            method: 'POST',
            mode: 'cors',
          })
          
Notice how data is being grouped, and being sent in several different levels.

Once this Source is connected using the Shuttle API, this data will be populated into Shuttle. Shuttle will flatten these different layers programatically, and parse the data into separate fields. Those separate fields will then be available to be mapped into separate Relay Fields.

In order to learn how to map fields, continue to the Mapping Source fields article.

How did we do?