Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Dictionary.ToJSON
Returns JSON representation of dictionary for data exchange.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Dictionary JSON | 6.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
DictionaryRef | The reference number to the dictionary. | $dic |
Result
Returns JSON or error.
Description
Returns JSON representation of dictionary for data exchange.This is useful for passing data from dictionary to some javascript.
Examples
Test exporting dictionaries:
#
#
#Create new Dictionary
#
Set Variable [$param; Value:MBS( "Dictionary.Create" )]
#
#Fill in values
#
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "text"; Pass Parameters with Dictionary::TextField )]
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "number"; Pass Parameters with Dictionary::NumberField)]
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "date"; Pass Parameters with Dictionary::DateField)]
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "time"; Pass Parameters with Dictionary::TimeField)]
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "timestamp"; Pass Parameters with Dictionary::TimeStampField)]
Set Variable [$r; Value:MBS( "Dictionary.SetValueForKey"; $param; "container"; Pass Parameters with Dictionary::ContainerField)]
#
#Call save xml, json and text
#
Set Variable [$r; Value:MBS( "Text.WriteTextFile"; MBS("Dictionary.ToXML"; $param; 1); MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ) ; "dictionary.xml"); "UTF8")]
Set Variable [$r; Value:MBS( "Text.WriteTextFile"; MBS("Dictionary.ToText"; $param); MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ) ; "dictionary.txt"); "UTF8")]
Set Variable [$r; Value:MBS( "Text.WriteTextFile"; MBS("Dictionary.ToJSON"; $param); MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ) ; "dictionary.json.txt"); "UTF8")]
#
#free memory
#
Set Variable [$r; Value:MBS("Dictionary.Release"; $param)]
See also
- Dictionary.AddSQLRecord
- Dictionary.AddSQLRecords
- Dictionary.Create
- Dictionary.Lookup
- Dictionary.Release
- Dictionary.SetValueForKey
- Dictionary.ToXML
- Folders.UserDesktop
- Path.AddPathComponent
- Text.WriteTextFile
Release notes
- Version 12.0
- Fixed JSON functions to return NULL for numbers with no content, e.g. empty text. This affects JSON.CreateNumber, Dictionary.ToJSON, FM.SQL.JSONColumn, FM.SQL.JSONRecord and FM.SQL.JSONRecords functions.
- Version 11.0
- Fixed issue with FM.SQL.JSONRecord, FM.SQL.JSONRecords and Dictionary.ToJSON where long numbers where truncated to double precision.
Blog Entries
- MBS FileMaker Plugin, version 11.6pr3
- Neues MBS FileMaker Plugin 11.1
- MBS FileMaker Plugin 11.1
- MBS FileMaker Plugin, version 10.6pr3
- With JSON in excellent form
- Data structures in FileMaker with MBS Plugins
- MBS FileMaker Plugin, version 6.1pr3
This function checks for a license.
Created 25th February 2016, last changed 9th November 2021