Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Dictionary.Deserialize

Restores a serialized dictionary.

Component Version macOS Windows Linux Server iOS SDK
Dictionary 5.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Dictionary.Deserialize"; Text )   More

Parameters

Parameter Description Example
Text The serialized data as text.

Result

Returns dictionary reference number or error.

Description

Restores a serialized dictionary.

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

Release notes

  • Version 8.2

Example Databases

Blog Entries

This function checks for a license.

Created 6th July 2015, last changed 22nd February 2016


Dictionary.CreateNamed - Dictionary.FromJSON