Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Let's create a more complex example for JSON.Search function in MBS FileMaker Plugin by combining various JMESPath features. Consider the following JSON data representing a list of students and their courses:

{
	"students":	[
		{
			"name":	"Alice",
			"age":	21,
			"courses":	[
				{
					"title":	"Math",
					"grade":	90
				}, 
				{
					"title":	"Physics",
					"grade":	85
				}
			]
		}, 
		{
			"name":	"Bob",
			"age":	22,
			"courses":	[
				{
					"title":	"Math",
					"grade":	78
				}, 
				{
					"title":	"History",
					"grade":	92
				}
			]
		}, 
		{
			"name":	"Charlie",
			"age":	20,
			"courses":	[
				{
					"title":	"Physics",
					"grade":	88
				}, 
				{
					"title":	"History",
					"grade":	85
				}
			]
		}
	]
}

 

Now, let's perform a few JMESPath queries:

 

1. Get the names of students who are taking the "Math" course:

 

students[?courses[?title == 'Math']].name

 

["Alice", "Bob"]

 

2. Find the average age of students:

 

avg(students[].age)

 

21.0

 

3. List the courses with grades greater than 80 for each student:

 

students[].{Name: name, Courses: courses[?grade > `80`].title}

 

[

{

"Name": "Alice",

"Courses": [

"Math"

"Physics"

]

}, 

{

"Name": "Bob",

"Courses": [

"History"

]

}, 

{

"Name": "Charlie",

"Courses": [

"Physics"

"History"

]

}

]

 

4. Calculate the total grade points for each student:

 

students[].{Name: name, TotalGradePoints: (courses[*].grade | sum(@)) }

 

[

{

"Name": "Alice",

"TotalGradePoints": 175.0

}, 

{

"Name": "Bob",

"TotalGradePoints": 170.0

}, 

{

"Name": "Charlie",

"TotalGradePoints": 173.0

}

]

 

5. Find students who have a grade higher than 85 in at least one course:

 

students[?courses[?grade > `85`]].name

 

["Alice", "Bob"]

 

6. Retrieve the names of students who take both "Math" and "History":

 

students[?courses[?title == 'Math']] | [?courses[?title == 'History']].name

 

[

"Bob"

]

 

These examples demonstrate how you can combine JMESPath expressions to perform more complex queries on nested JSON data. Feel free to modify and experiment with the expressions to suit your specific needs.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.