Skip to content

JSON.Merge fails if the first character in a value is a quote mark #19

@davegraham92120

Description

@davegraham92120

If the first character of a value is a quote (i.e., Char ( 34 )), JSON.Merge treats the value as JSONRaw, which alters the value.

For instance, given take this valid JSON value: ""Full Name" email@domain.com"

JSON.Merge lets FileMaker decide it's type, which results in data loss:

Let ( foo = Quote ( "First Last" ) & "<name@domain.com>" ;  
	JSONSetElement ( "{}" ; "bar" ; foo ; "" )
) = {"bar":"First Last"}

We need to make sure to cast it as a JSONString:

Let ( foo = Quote ( "First Last" ) & "<name@domain.com>" ;  
	JSONSetElement ( "{}" ; "bar" ; foo ; JSONString )
) = {"bar":"\"First Last\"<name@domain.com>"}

We need to include a check for at least Char (34) when deciding to explicitly cast the JSONSetElement as a JSONString, and possibly other values as well.

Stay tuned for the file that includes the test and fix.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions