|Mac & Win
Imports JSON and creates tables, fields and records.
|The JSON data to import.
Please pass text, not reference numbers.
|The file name of where the insert table is inside. Can be empty.
|The prefix to put in front of all tables.
|Available in MBS FileMaker Plugin 12.2 or newer.
The default root table name.
Default is "json".
|Available in MBS FileMaker Plugin 12.3 or newer.
Sum of flags.
Add 128 to skip table creation.
Add 256 to skip field creation.
Add 512 to ignore duplicate errors for FileMaker's validation (since v13.5).
Add 1024 to not create UUID fields (since v13.5).
Returns number or error.
DescriptionImports JSON and creates tables, fields and records.
This function can import any JSON into FileMaker tables with all fields and attributes.
Returns number of records to be added. This function prefers the import and runs it later at idle time. In a script please call JSON.Import and then loop and do script pauses. Then use JSON.Import.Status to check regularly for updates. When you get back Finished as status, the script can continue with other work.
If you have a JSON file you need to import regularly into FileMaker and you have no XSLT to transform it for FileMaker, you can use this plugin function. On the first run, it creates for a sample JSON file the required tables and fields. Then you can define any layout or script to process values, e.g. copy into your tables. On further runs the plugin may add more fields (if newer JSON file has more fields) and import newer records.
All tables have three default fields. _RecordUUID is an unique identifier for the record. _ParentRecordUUID provides a link to the record one level higher in the JSON. This can be used to find child/parent records. The _CreationTimeStamp is the creation date, so you can distinguish different imports.
As a lot of records with a lot of data is imported and you may not need everything, you may want to put the imports in an extra FileMaker file. You decide if you clear tables before import or you want to keep history of all imports.
If the JSON has errors like a missing < in the JSON, you get an error. If you switch on IgnoreError parameter, the plugin reads everything until the error is reached which may give less records than possible.
This function works at idle time which is not supported on server. But you can use the function JSON.Import.Work to perform the work instead of the idle handler. This enables importing of data, but not table/field creation.
Requires FileMaker 12 or newer.
On Server, please add a loop calling JSON.Import.Work to make progress.
See also XML.Import.SetBaseFields and XML.Import.SetExtraField.
We use SQL to create records, so you can check FM.ExecuteSQL.LastErrorMessage and FM.ExecuteSQL.LastSQL after the import for SQL errors.
Please wait for an import to finish before calling JSON.Import or XML.Import again since it will cancel the last import and start a new one.
Import fails if a table or field name matches a reserved word in FileMaker like RowId. Please rename entries if needed.
Since v13.5 you can explicit ask the plugin to not create UUID fields with the flag value 1024. Be aware, that this prevents us from giving you structural data like which child record belongs to which parent. But your import data may already have primary keys for this. Add flag 512 to ignore duplicate errors in FileMaker's field validation. This is useful if you mark some field as unique in FileMaker with always validation and import the same data again.
Imports test.json into FileMaker:
Import script with progress bar for importing JSON with Windows ANSI encoding:
- Version 13.5
- Version 13.4
- Improved JSON.Import to better handle arrays in arrays.
- Version 12.4
- Version 12.2
- Added new optional RootTableName parameter for JSON.Import function.
- Version 11.3
- Version 9.3
- MBS FileMaker Plugin, version 13.5pr7
- MBS Plugin 13.4 for Claris FileMaker - More than 7100 Functions In One Plugin
- MBS FileMaker Plugin, version 13.4pr3
- MBS Plugin 12.4 for Claris FileMaker
- MBS FileMaker Plugin, version 12.4pr5
- MBS FileMaker Plugin 12.2
- MBS Plugin 12.2 for Claris FileMaker
- FileMaker 19.2 and the new fmplugin extended privilege
- With JSON in excellent form
- MBS FileMaker Plugin 5.4 for OS X/Windows
This function checks for a license.
Created 26th October 2015, last changed 27th October 2023