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.ArrayLength is incorrect with empty string as value #18

Open
rwu2359 opened this issue Jun 15, 2018 · 2 comments
Open

JSON.ArrayLength is incorrect with empty string as value #18

rwu2359 opened this issue Jun 15, 2018 · 2 comments

Comments

@rwu2359
Copy link

rwu2359 commented Jun 15, 2018

If the array contains values which are an empty string i.e. "" the function will not return the correct number of items in the array
Suggest changing to

_values = JSONListKeys ( _array ; path )

This will return the correct number of full or empty slots in the array

@rwu2359 rwu2359 changed the title JSON.ArrayLength will fail with empty string as value JSON.ArrayLength is incorrect with empty string as value Jun 15, 2018
@DanShockley
Copy link

DanShockley commented Jun 25, 2021

Here's a test that demonstrates the error:
JSON.ArrayLength ( "[ 1, \"\", 3 ]" ; "" )
should give a result of 3, but instead gives 2.
The suggested fix by @rwu2359 would address this error.

@DanShockley
Copy link

I'm having trouble attaching files to the comment above, so I will try here:
I've attached a copy of the JSONAdditions.fmp12 file that give an example of the error, and a copy that includes the fix.
JSONAdditions-ArrayLength-empty-string-bug-example.fmp12.zip
JSONAdditions-ArrayLength-empty-string-bug-FIXED.fmp12.zip

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