Skip to content
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

JSON.GetValuesAtPath doesn't honor blank values in the array. #26

Open
flybynight27 opened this issue Sep 2, 2020 · 1 comment
Open

Comments

@flybynight27
Copy link

If I have an array where a certain key sometimes contains data and sometimes does not, the JSON.GetValuesAtPath does not leave those blank values in place, because it uses List. Since these are arrays, I would expect the order and placement to be honored.

Here is an alternative method that would leave blank lines in place:

While (

[
	¢Count = ValueCount ( JSONListKeys ( Array ; "" ) ) ;
	¢Iteration = 0 ;
	¢Values = ""
] ;

¢Iteration < ¢Count ;

[
	¢Values = ¢Values & Case ( not IsEmpty ( ¢Values ) ; "¶" ) & JSONGetElement ( Array ; "[" & ¢Iteration & "]" & Path ) ;
	¢Iteration = ¢Iteration + 1
] ;

¢Values

)
@DanShockley
Copy link

Interesting point. I guess the counter-argument is that this is getting "Values" as FileMaker defines them, so perhaps this behavior is intentional? In other words, this function is doing for arrays what the "List" function does for related fields?
Maybe a secondary function would be needed, to preserve the existing behavior that people might have relied on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants