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.

Need a little JSON formatting education

Featured Replies

Hi all:

I threw together a JSON sandbox file (attached) and looking at one result, I'm not sure if step 18 in the script, Nested Array/Children Records is coded correctly. What that script does is create a field that includes parent and child records between the Grant and District tables. When run, if you look at the JSON field's result, it doesn't (to me) look right--shouldn't the District key be indented as a array or no? The reason why I ask is that when I use the JSONListKeys in the Data Viewer as JSONListKeys ( GRANT::JSON ; "Grant" ), it lists a record count instead of "District," so what am I missing here...or am I just being an absolute numpty?

Cheers,

Rich

JSON Coding.fmp12

I am not sure what exactly you are asking or what to look at in the attached file.

 

3 hours ago, Richard Stuart said:

shouldn't the District key be indented as a array

From what I can see, the JSON in the GRANT::JSON field in the 4th record of your file is properly formatted - at least by the rules that Filemaker uses for formatting JSON (there is no official standard for this and you may see various online formatters return different results).

 

3 hours ago, Richard Stuart said:

when I use the JSONListKeys in the Data Viewer as JSONListKeys ( GRANT::JSON ; "Grant" ), it lists a record count instead of "District,"

Well, Grant in your JSON is also an array. The keys of any array are the numerical indexes of the array's child elements. The District array is a grandchild of Grant, and you will see it listed if you look at JSONListKeys ( GRANT::JSON ; "Grant[0]" ) or JSONListKeys ( GRANT::JSON ; "Grant[1]" ) and so on.

 

Edited by comment

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.