-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timestamps not encoded properly #34
Comments
FYI: while encoding dates/timestamps can be done this way (once the bug is fixed), if your JSON needs to be read by anything but FileMaker then you may want to read this: http://stackoverflow.com/a/15952652 |
NOTE: timestamps, dates, and times are converted to numbers in FileMaker's own internal number format. This is useful for parsing within FileMaker, but not useful for interacting with other services that expect a standard format like YYYY-MM-DD. Currently, you must manually convert timestamps, dates, and times to whatever standard format you need, if sending the JSON to a different system that expects a particular format.
Hi Dan! Did you consider adding an optional third argument to jsonOp( key; value {; type } ), and a second to jsonGet( key { ; type } )? We would loose in succinctness, I grant you that, but this way, the functions could deal with timestamp and date conversions (to various standards, ie. ISO8601, unixTS, etc. ) without further external dependencies, since, as you mention, it is pretty much intrinsic to proper parsing from one language to the other? -- It would also allow properly converting boolean values... -- I would be happy to contribute, if you find that a viable solution. |
If FileMaker allowed for optional parameters in custom functions, I would be all for adding this feature. But since it doesn't, I wouldn't want to change If you wanted to add this feature, I think the most appropriate way would be to fork the repo and change the functions in your fork. Personally, would deal with this type of conversion by writing a separate custom function for each format I want to convert to/from, like so:
P.S. I've addressed the issue of Boolean's via two reserved strings:
Similarly, I use a reserved string for
|
Personally, I wouldn't want this built into the JSON functions. Timestamp conversion is useful outside of that narrow requirement. @jean-Phil, you might like to take a look at the fm-library project, which has a few custom functions that you might be interested in.
There are some dependencies, such as |
it should return:
Originally reported here: dansmith65/FileMaker-JSON#9
The text was updated successfully, but these errors were encountered: