This browser may not honor CSS 2.1 and hence may not be capable to display this FMDiff report correctly. Please upgrade to a more recent browser version. Recommended browsers are: FireFox, Safari, or equivalent.
#
2014-MAR-30 Daniel Smith
- update #List ( value ) function used in encode value section
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
#
2014-MAR-30 Daniel Smith
- update #List ( value ) function used in encode value section to version date 2014-06-06
2014-MAR-30 Daniel Smith
- update #List ( value ) function used in encode value section
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
#
2014-MAR-30 Daniel Smith
- update # ( name ; value ) function used in encode object section
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
#
2014-JUL-29 Daniel Smith
- update # ( name ; value ) function used in encode object section to version date 2014-06-06
2014-MAR-30 Daniel Smith
- update # ( name ; value ) function used in encode object section
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
Perform Script[ “~JSON-FM Next { character }”; Parameter: ":" ]
Perform Script[ “~JSON-FM Next { character }”; Parameter: ":" ]
35
If[ False ]
If[ False ]
36
# when using the custom functions available at the link below to access data, this section is not needed since new key's replace old keys
http://filemakerstandards.org/x/loEI
# when using the custom functions available at the link below to access data, this section is not needed since new key's replace old keys
http://filemakerstandards.org/x/loEI
# No strict dependencies, see installation section for optional dependencies.
# No strict dependencies, see installation section for optional dependencies.
19
#
#
20
#
#
21
#
#
22
# INTEGRATION
# INTEGRATION
23
# ( it's wise to check the Import.log file for errors, as you add elements to your database )
# ( it's wise to check the Import.log file for errors, as you add elements to your database )
24
# 1. import module script folder
# 1. import module script folder
25
#
#
26
# 2. review all scripts in the module Config folder, adjust as necessary
# 2. review all scripts in the module Config folder, adjust as necessary
27
#
#
28
# 3. import custom functions:
# 3. import custom functions:
29
# for retrieving values from parsed JSON:
# for retrieving values from parsed JSON:
30
# (these are optional since you could manually extract the values)
# (these are optional since you could manually extract the values)
31
# - [optional] #Get
# - [optional] #Get
32
# - [optional] #ListGet
# - [optional] #ListGet
33
# - [optional] #GetNameList
(is helpful when you want to iterate through all objects)
# - [optional] #GetNameList
(is helpful when you want to iterate through all objects)
34
# for creating FileMaker Let notation in the format the FM-JSON script expects:
# for creating FileMaker Let notation in the format the FM-JSON script expects:
35
# (these are optional since you could manually encode the values)
# (these are optional since you could manually encode the values)
36
# - [optional] #
# - [optional] #
37
# - [optional] #List
# - [optional] #List
38
# Other useful custom functions in this suite can be found in the #Parameters module
http://www.modularfilemaker.org/2013/07/parameters/
# Other useful custom functions in this suite can be found in the #Parameters module
http://www.modularfilemaker.org/module/parameters/
39
#
#
40
#
#
41
#
#
42
# INSTRUCTIONS FOR USE
# INSTRUCTIONS FOR USE
43
# Please refer to the "FM > JSON: Sandbox" section of the demo file for examples of how to access data from a parsed json string.
# Please refer to the "FM > JSON: Sandbox" section of the demo file for examples of how to access data from a parsed json string.
44
# The unit tests serve as documentation for the values you should expect to get from this module.
# The unit tests serve as documentation for the values you should expect to get from this module.
45
#
#
46
#
#
47
#
#
48
# KNOWN ISSUES
# KNOWN ISSUES
49
# 1. Object name's in JSON do not have any restrictions on the characters that can be used; FileMaker Let Notation does.
The JSON-FM scripts removes invalid characters from object names, so you may need to account for this when accessing objects. See unit test titled "object name with invalid characters" for an example of this.
This issue could be resolved by using an encoding/decoding format that fully escapes an object name, like the one available here: http://sixfriedrice.com/wp/passing-multiple-parameters-to-scripts-advanced/.
To make this change, two scripts need to be modified:
1. ~JSON-FM Array
Set Variable step followed by the comment "encode value"
2. ~JSON-FM Object
Set Variable step followed by the comment "encode object"
Set Variable step followed by the comment "remove characters that are invalid for use in a let variable"
The FM-JSON scripts do not provide the ability to create JSON with certain character in an objects name, it is restricted to the name being a valid let variable name. These scripts are completely dependent on the storage format used, so to implement a storage format that allows for any name in an object, you would need to modify most (if not all) of the FM-JSON scripts.
# 1. Object name's in JSON do not have any restrictions on the characters that can be used; FileMaker Let Notation does.
The JSON-FM scripts removes invalid characters from object names, so you may need to account for this when accessing objects. See unit test titled "object name with invalid characters" for an example of this.
This issue could be resolved by using an encoding/decoding format that fully escapes an object name, like the one available here: http://sixfriedrice.com/wp/passing-multiple-parameters-to-scripts-advanced/.
To make this change, two scripts need to be modified:
1. ~JSON-FM Array
Set Variable step followed by the comment "encode value"
2. ~JSON-FM Object
Set Variable step followed by the comment "encode object"
Set Variable step followed by the comment "remove characters that are invalid for use in a let variable"
The FM-JSON scripts do not provide the ability to create JSON with certain character in an objects name, it is restricted to the name being a valid let variable name. These scripts are completely dependent on the storage format used, so to implement a storage format that allows for any name in an object, you would need to modify most (if not all) of the FM-JSON scripts.
50
# 2. True/False are not used - only 1/0.
- when converting from FM-JSON
# 2. True/False are not used - only 1/0.
- when converting from FM-JSON
51
# 3. null is used instead of empty string
- when converting from FM-JSON
# 3. null is used instead of empty string
- when converting from FM-JSON
52
#
#
53
#
#
54
#
#
55
# UPGRADE PROCESS
56
# ( use these instructions when you already have the JSON module installed, but want to upgrade to the latest version )
57
# 1. Review the change log in the "JSON: Version X.X.X" script for version-specific update steps.
58
# 2. Delete the "JSON: Private" script folder
59
# 3. Import the "JSON: Private" script folder from the updated module
60
# 4. Edit every script in the "JSON: Public" folder:
61
# a. delete all script steps
62
# b. copy/paste all script steps from the same script in the updated module
63
#
64
#
65
#
66
# LICENSE:
# LICENSE:
67
# The MIT License (MIT)
Copyright (c) 2014 Daniel Smith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# The MIT License (MIT)
Copyright (c) 2014 Daniel Smith
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# This guideline was heavily influenced by http://semver.org/spec/v2.0.0-rc.1.html
# This guideline was heavily influenced by http://semver.org/spec/v2.0.0-rc.1.html
11
# Changelog: Summary is formatted with markdown: http://daringfireball.net/projects/markdown/
- use different header 'tag' (#'s) depending on the version being incremented
Major: H1
Minor: H2
Patch: H3
# Changelog: Summary is formatted with markdown: http://daringfireball.net/projects/markdown/
- use different header 'tag' (#'s) depending on the version being incremented
Major: H1
Minor: H2
Patch: H3
# MAJOR:
Arbitrarily defined by the developer, but must introduce significant change to either the feature set, or the internal method of processing.
# MAJOR:
Arbitrarily defined by the developer, but must introduce significant change to either the feature set, or the internal method of processing.
18
# MINOR:
New features. Should be incremented whenever a new feature is added.
# MINOR:
New features. Should be incremented whenever a new feature is added.
19
# PATCH:
Bug fixes. Should not introduce new features (unless the lack of that feature can be considered a bug).
# PATCH:
Bug fixes. Should not introduce new features (unless the lack of that feature can be considered a bug).
20
# {-PRERELEASE} OPTIONAL
A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
This value can be compaired as text in FileMaker, and the following will be true: "alpha" < "beta" and "alpha" < "rc" and "beta" < "rc".
# {-PRERELEASE} OPTIONAL
A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
This value can be compaired as text in FileMaker, and the following will be true: "alpha" < "beta" and "alpha" < "rc" and "beta" < "rc".
21
# {+} OPTIONAL
If the file has been modified since the version was last incremented, and the version does not need to be incremented yet (still under development), append the version string with a +.
# {+} OPTIONAL
If the file has been modified since the version was last incremented, and the version does not need to be incremented yet (still under development), append the version string with a +.
22
#
#
23
# These guidelines should be followed:
# These guidelines should be followed:
24
# Use decimal separated text to store the version.
# Use decimal separated text to store the version.
25
# When evaluating the version, MUST NOT convert the entire text to a number. Each decimal separated section must be evaluated individually, and in order. Here is a possible method of doing so:
Let ( [
ver = "1.2.21" ;
// extract pre-release version string
ver = Substitute ( ver ; "-" ; ¶ ) ;
preRelease = GetValue ( ver ; 2 ) ;
// extract normal version string
ver = GetValue ( ver ; 1 ) ;
ver = Substitute ( ver ; "." ; ¶ ) ;
major = GetAsNumber ( GetValue ( ver ; 1 ) ) ;
minor = GetAsNumber ( GetValue ( ver ; 2 ) ) ;
patch = GetAsNumber ( GetValue ( ver ; 3 ) )
] ;
// evaluate version
Case (
major = 0 ;
"initial development" ;
major = 1 ;
"first public release"
)
)
# When evaluating the version, MUST NOT convert the entire text to a number. Each decimal separated section must be evaluated individually, and in order. Here is a possible method of doing so:
Let ( [
ver = "1.2.21" ;
// extract pre-release version string
ver = Substitute ( ver ; "-" ; ¶ ) ;
preRelease = GetValue ( ver ; 2 ) ;
// extract normal version string
ver = GetValue ( ver ; 1 ) ;
ver = Substitute ( ver ; "." ; ¶ ) ;
major = GetAsNumber ( GetValue ( ver ; 1 ) ) ;
minor = GetAsNumber ( GetValue ( ver ; 2 ) ) ;
patch = GetAsNumber ( GetValue ( ver ; 3 ) )
] ;
// evaluate version
Case (
major = 0 ;
"initial development" ;
major = 1 ;
"first public release"
)
)
26
# Summarize the changes of each version in a single comment step below. This should be a brief overview of the changes, whereas the Changelog: Detailed script contains the detailed daily changes.
# Summarize the changes of each version in a single comment step below. This should be a brief overview of the changes, whereas the Changelog: Detailed script contains the detailed daily changes.
# ## 1.0.1 ##
- fix Issue #1 and #2 from GitHub
- modify scripts:
- JSON: Changelog: Detailed
- deleted, will store list of all changes in the version script instead
- ~JSON-FM Object
- update # ( name ; value ) function used in encode object section
- ~JSON-FM Array
- update #List ( value ) function used in encode value section
- ~FM-JSON { value }
- fix handling of LF and CRLF returns/line endings
- accommodate numbers encoded with GetAsNumber
- return an error if an unknown GetAs... function is detected
- prepend decimals with a 0, as required by JSON standard
- ~FM-JSON { object }
- process object as ¶ delimited list instead of a return delimited list, which didn't work for Char(10)
- this is now the same method of processing as #Get ( parameters ; name ) function uses
- ~JSON-FM Next { character }
- add space before "instead of"
- JSON: READ ME
- update documentation
# ### 1.0.2 ###
- modify scripts:
- ~FM-JSON { value }
- update test that differentiates an array from a string
- previously, a quoted number was interpreted as an array
- ~JSON-FM Object
- update # ( name ; value ) function used in encode object section to version date 2014-06-06
- ~JSON-FM Array
- update #List ( value ) function used in encode value section to version date 2014-06-06
- JSON: READ ME
- add "UPGRADE PROCESS" section
34
# ### 1.0.1 ###
- fix Issue #1 and #2 from GitHub
- modify scripts:
- JSON: Changelog: Detailed
- deleted, will store list of all changes in the version script instead
- ~JSON-FM Object
- update # ( name ; value ) function used in encode object section
- ~JSON-FM Array
- update #List ( value ) function used in encode value section
- ~FM-JSON { value }
- fix handling of LF and CRLF returns/line endings
- accommodate numbers encoded with GetAsNumber
- return an error if an unknown GetAs... function is detected
- prepend decimals with a 0, as required by JSON standard
- ~FM-JSON { object }
- process object as ¶ delimited list instead of a return delimited list, which didn't work for Char(10)
- this is now the same method of processing as #Get ( parameters ; name ) function uses
- ~JSON-FM Next { character }
- add space before "instead of"
- JSON: READ ME
- update documentation
# Convert a value into JSON. The value can be let notation, array, or a single value ( text, date, time, timestamp).
# Convert a value into JSON. The value can be let notation, array, or a single value ( text, date, time, timestamp).
4
#
#
5
# PARAMETERS:
# PARAMETERS:
6
# value | object, array, or single value
# value | object, array, or single value
7
#
#
8
# RETURNS:
# RETURNS:
9
# JSON encoded text.
# JSON encoded text.
10
#
#
11
# REVISIONS:
# REVISIONS:
12
#
2014-MAR-30 Daniel Smith
- fix handling of LF and CRLF returns/line endings
2014-FEB-20 Daniel Smith dansmith65@gmail.com
- accommodate numbers encoded with GetAsNumber
- return an error if an unknown GetAs... function is detected
- prepend decimals with a 0, as required by JSON standard
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
#
2014-JUL-29 Daniel Smith
- update test that differentiates an array from a string
- previously, a quoted number was interpreted as an array
2014-MAR-30 Daniel Smith
- fix handling of LF and CRLF returns/line endings
2014-FEB-20 Daniel Smith dansmith65@gmail.com
- accommodate numbers encoded with GetAsNumber
- return an error if an unknown GetAs... function is detected
- prepend decimals with a 0, as required by JSON standard
2013-AUG-06 Daniel Smith dansmith65@gmail.com
- created
# This guideline was heavily influenced by http://semver.org/spec/v2.0.0-rc.1.html
# This guideline was heavily influenced by http://semver.org/spec/v2.0.0-rc.1.html
12
# Changelog: Summary is formatted with markdown: http://daringfireball.net/projects/markdown/
- use different header 'tag' (#'s) depending on the version being incremented
Major: H1
Minor: H2
Patch: H3
# Changelog: Summary is formatted with markdown: http://daringfireball.net/projects/markdown/
- use different header 'tag' (#'s) depending on the version being incremented
Major: H1
Minor: H2
Patch: H3
# MAJOR:
Arbitrarily defined by the developer, but must introduce significant change to either the feature set, or the internal method of processing.
# MAJOR:
Arbitrarily defined by the developer, but must introduce significant change to either the feature set, or the internal method of processing.
19
# MINOR:
New features. Should be incremented whenever a new feature is added.
# MINOR:
New features. Should be incremented whenever a new feature is added.
20
# PATCH:
Bug fixes. Should not introduce new features (unless the lack of that feature can be considered a bug).
# PATCH:
Bug fixes. Should not introduce new features (unless the lack of that feature can be considered a bug).
21
# {-PRERELEASE} OPTIONAL
A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
This value can be compaired as text in FileMaker, and the following will be true: "alpha" < "beta" and "alpha" < "rc" and "beta" < "rc".
# {-PRERELEASE} OPTIONAL
A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.
This value can be compaired as text in FileMaker, and the following will be true: "alpha" < "beta" and "alpha" < "rc" and "beta" < "rc".
22
# {+} OPTIONAL
If the file has been modified since the version was last incremented, and the version does not need to be incremented yet (still under development), append the version string with a +.
# {+} OPTIONAL
If the file has been modified since the version was last incremented, and the version does not need to be incremented yet (still under development), append the version string with a +.
23
#
#
24
# These guidelines should be followed:
# These guidelines should be followed:
25
# Use decimal separated text to store the version.
# Use decimal separated text to store the version.
26
# When evaluating the version, MUST NOT convert the entire text to a number. Each decimal separated section must be evaluated individually, and in order. Here is a possible method of doing so:
Let ( [
ver = "1.2.21" ;
// extract pre-release version string
ver = Substitute ( ver ; "-" ; ¶ ) ;
preRelease = GetValue ( ver ; 2 ) ;
// extract normal version string
ver = GetValue ( ver ; 1 ) ;
ver = Substitute ( ver ; "." ; ¶ ) ;
major = GetAsNumber ( GetValue ( ver ; 1 ) ) ;
minor = GetAsNumber ( GetValue ( ver ; 2 ) ) ;
patch = GetAsNumber ( GetValue ( ver ; 3 ) )
] ;
// evaluate version
Case (
major = 0 ;
"initial development" ;
major = 1 ;
"first public release"
)
)
# When evaluating the version, MUST NOT convert the entire text to a number. Each decimal separated section must be evaluated individually, and in order. Here is a possible method of doing so:
Let ( [
ver = "1.2.21" ;
// extract pre-release version string
ver = Substitute ( ver ; "-" ; ¶ ) ;
preRelease = GetValue ( ver ; 2 ) ;
// extract normal version string
ver = GetValue ( ver ; 1 ) ;
ver = Substitute ( ver ; "." ; ¶ ) ;
major = GetAsNumber ( GetValue ( ver ; 1 ) ) ;
minor = GetAsNumber ( GetValue ( ver ; 2 ) ) ;
patch = GetAsNumber ( GetValue ( ver ; 3 ) )
] ;
// evaluate version
Case (
major = 0 ;
"initial development" ;
major = 1 ;
"first public release"
)
)
27
# Summarize the changes of each version in a single comment step below. This should be a brief overview of the changes, whereas the Changelog: Detailed script contains the detailed daily changes.
# Summarize the changes of each version in a single comment step below. This should be a brief overview of the changes, whereas the Changelog: Detailed script contains the detailed daily changes.
# ### 1.0.1 ###
- unit tests for FM-JSON:
- "text miss-interpreted as a date" unit test now produces expected result
- add unit tests for "quoted number treated as list" bug
- add misc. unit tests
- add unit tests with large chunks of data to better represent real-world data
- update custom functions to current #Parameters module version 1.1.3:
- #
- #List
35
# # 1.0.0 #
- the first release of this file did not include a separate version script for the application. This version script was created with JSON: Version 1.0.1.
- updated custom functions:
#
#GetNameList
#List
- add unit tests for JSON-FM:
- Object with returns
- Array with returns
- unit tests for FM-JSON:
- modify: Escape characters pt 2: returns/line endings
- add: Escape characters pt 4: returns/line endings in object
- scripts
- added
- JSON-FM: Go To
- FM-JSON: Go To
- deleted
- Toggle section
- modified
- FM-JSON: Parse All Found
- FM-JSON: Parse letNotation text { skipRefresh }
- FM-JSON: Parse letNotation expression { skipRefresh }
- update navigation button in header
# # 1.0.0 #
- the first release of this file did not include a separate version script for the application. This version script was created with JSON: Version 1.0.1.
- updated custom functions:
#
#GetNameList
#List
- add unit tests for JSON-FM:
- Object with returns
- Array with returns
- unit tests for FM-JSON:
- modify: Escape characters pt 2: returns/line endings
- add: Escape characters pt 4: returns/line endings in object
- scripts
- added
- JSON-FM: Go To
- FM-JSON: Go To
- deleted
- Toggle section
- modified
- FM-JSON: Parse All Found
- FM-JSON: Parse letNotation text { skipRefresh }
- FM-JSON: Parse letNotation expression { skipRefresh }
- update navigation button in header