Menu icon Foundation
How to pull JSON data into Foundation for Email

I have a JSON file with nested arrays that contains course information. The arrays are set up to group by region, then by city, then by the courses in each city. I am having difficulty calling by data into my src file. My JSON file is called "temp-int-training2". Here is a sample of my JSON code:

{
  "oceania": [
 				{
          	  	"city": [
				  			{
			  				"city-name" : "Alice Springs",
              				"courses" : [
							  			{
							  			"date": "Oct. 23-25",
							  			"title": "Business Acumen for Compensation Professionals"
							  			},
										{
							  			"date": "Nov. 23-25",
							  			"title": "International Remuneration — An Overview of Global Rewards (GR7)"
							  			}
										]
				  			}
			  			]
              	} 

   			],

  "asia": [
              {
          	  "city": [
				  			{
				  			"city-name" : "Tokyo",
							"courses" : [
                          				{
                          				"date": "Oct. 23-25",
                      	  				"title": "International Financial Reporting Standards for Compensation Professionals"
                          				},
										{
										"date": "Oct. 23-25",
										"title": "International Remuneration — An Overview of Global Rewards (GR7)"
										}
                        				]
              				}
					]
			  }
	  ]
}

Here is how I am calling in my fields from the JSON file:

{{#if temp-int-training2.oceania}}	
   {{#each temp-int-training2.oceania}}

	<p>
	1. <strong>{{city.0.city-name}}</strong><br>
	2. {{city.0.courses.0.date}}<br>
	3. {{city.0.courses.0.title}}<br>
	</p>

    {{/each}}
{{/if}}	

I can't seem to get it to pull in anything other than the first date in the "course" array. The output looks like this:

1. Alice Springs

2. Oct. 23-25

3. Business Acumen for Compensation Professionals

I know I'll need to create a separate call to pull in my Asia data, but does anybody know how to pull in more than one course in the city array?

Brad

 

emailJSONpanini

I have a JSON file with nested arrays that contains course information. The arrays are set up to group by region, then by city, then by the courses in each city. I am having difficulty calling by data into my src file. My JSON file is called "temp-int-training2". Here is a sample of my JSON code:

{
  "oceania": [
 				{
          	  	"city": [
				  			{
			  				"city-name" : "Alice Springs",
              				"courses" : [
							  			{
							  			"date": "Oct. 23-25",
							  			"title": "Business Acumen for Compensation Professionals"
							  			},
										{
							  			"date": "Nov. 23-25",
							  			"title": "International Remuneration &mdash; An Overview of Global Rewards (GR7)"
							  			}
										]
				  			}
			  			]
              	} 

   			],

  "asia": [
              {
          	  "city": [
				  			{
				  			"city-name" : "Tokyo",
							"courses" : [
                          				{
                          				"date": "Oct. 23-25",
                      	  				"title": "International Financial Reporting Standards for Compensation Professionals"
                          				},
										{
										"date": "Oct. 23-25",
										"title": "International Remuneration &mdash; An Overview of Global Rewards (GR7)"
										}
                        				]
              				}
					]
			  }
	  ]
}

Here is how I am calling in my fields from the JSON file:

{{#if temp-int-training2.oceania}}	
   {{#each temp-int-training2.oceania}}

	<p>
	1. <strong>{{city.0.city-name}}</strong><br>
	2. {{city.0.courses.0.date}}<br>
	3. {{city.0.courses.0.title}}<br>
	</p>

    {{/each}}
{{/if}}	

I can't seem to get it to pull in anything other than the first date in the "course" array. The output looks like this:

1. Alice Springs

2. Oct. 23-25

3. Business Acumen for Compensation Professionals

I know I'll need to create a separate call to pull in my Asia data, but does anybody know how to pull in more than one course in the city array?

Brad