Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
11.1
11.2
11.3
11.4
11.5
12.0
12.1
12.2
12.3
12.4
Statistic
FMM
Blog
Dictionary.Serialize
Serialized a dictionary as a text.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Dictionary | 5.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
DictionaryRef | The reference number to the dictionary. | $dic |
Result
Returns text or error.
Description
Serialized a dictionary as a text.The dictionary content is stored in a base64 encoded string which the plugin function Dictionary.Deserialize can read.
Does not work with external containers.
Using this function allows to store a dictionary in a text field or transmit it with Socket functions, SerialPort functions or by writing it to a file.
Examples
Create a dictionary and serialize it:
Set Variable [$list; Value:MBS( "Dictionary.Create"; "Hello"; "World"; "1234"; "Just a test!")]
Set Variable [$text; Value:MBS("Dictionary.Serialize"; $list)]
Set Variable [$SecondList; Value:MBS("Dictionary.Deserialize"; $text)]
Show Custom Dialog ["List"; "Encoded: " & $text & ¶ & ¶ & "Decoded Keys: " & MBS("Dictionary.Keys"; $secondList) & ¶ & ¶ & "D…]
Set Variable [$r; Value:MBS("Dictionary.Release"; $list)]
Set Variable [$r; Value:MBS("Dictionary.Release"; $secondList)]
Serialize and unserialize with date and time:
# Create Dictionary
Set Variable [$dict; Value:MBS ( "Dictionary.Create" )]
# put date and time inside:
Set Variable [$r; Value:MBS ( "Dictionary.SetValueForKey"; $dict; "theTime"; Get ( CurrentTime ))]
Set Variable [$r; Value:MBS ( "Dictionary.SetValueForKey"; $dict; "theDate"; Get ( CurrentDate ))]
# Serialize this
Set Variable [$dictEncoded; Value:MBS ( "Dictionary.Serialize"; $dict )]
#Free dictionary
Set Variable [$r; Value:MBS ( "Dictionary.Release"; $dict )]
# Unpack it:
Set Variable [$newDict; Value:MBS ( "Dictionary.Deserialize"; $dictEncoded )]
# and get values
Set Variable [$TheTime; Value: MBS ( "Dictionary.ValueForKey"; $newDict; "theTime" )]
Set Variable [$TheDate; Value: MBS ( "Dictionary.ValueForKey"; $newDict; "theDate" )]
Show Custom Dialog [$TheTime & " " & $TheDate]
Set Variable [$r; Value:MBS ( "Dictionary.Release"; $newDict )]
See also
- Dictionary.Create
- Dictionary.Deserialize
- Dictionary.Keys
- Dictionary.Release
- Dictionary.SetValueForKey
- Dictionary.ValueForKey
Example Databases
Blog Entries
- Data structures in FileMaker with MBS Plugins
- MBS FileMaker Plugin, version 6.1pr3
- MBS FileMaker Plugin, version 5.2pr6
Created 6th July 2015, last changed 1st March 2021
Dictionary.RemoveKey - Dictionary.SetList
Feedback: Report problem or ask question.
