-
Notifications
You must be signed in to change notification settings - Fork 259
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
[Bug]: json.path.put fails if there are no results #4123
Comments
This was a breaking change in json-path 2.7.0: It's not clear whether this is desired behavior (i.e., they could just be more strict now about existing expectations) or if this was some collateral damage. We may need to push for some updates there, otherwise I don't think there's much we can do about it. |
Was just revisiting this issue, and apparently was not paying close enough attention to the links last time. It looks like issues/changes you've posted are from much older versions, with the change happening in 2019. This issue is affecting code that works in the 1.13.2 release, but not 1.14.0-alpha1 - not sure how that change would be the cause? |
My mistake. I had the right issue numbers, but they naturally linked to ths maptool repo instead of the json-path repo 😬 I've updated my comment with the correct links. |
Been thinking about this one as I plan to make edits in order to test 1.14.0-alpha3. My planned solution on the MTScript side was just to make a wrapper function that first runs |
I've been able to work around this issue using a UDF as follows:
However, I've also noticed that this issue is present for While I was able to work around this easily with find and replace, users not using addons will probably have a more difficult time correcting all of their json.path functions. It would be preferable to fix this natively if possible. |
I haven't use .put yet, but does it work if you add the "SUPPRESS_EXCEPTIONS" option? I pretty much always use that. |
|
That makes sense since it's altering the data structure. Sorry for the dumb question. |
Tested. |
Describe the Bug
When using json.path.put in 1.14.0-alpha1, if the path given has no results then it fails with the error:
Error with function "json.path.put": null
.In prior releases, the function did not fail and moved on without putting anything in the json.
To Reproduce
Paste the following code into the chat:
In 1.14.0-alpha1, the output will be:
Expected Behaviour
In earlier releases, the output of the above would be:
The success key remaining even though testArray was not actually set to the result of the
json.path.put
function in the 3rd line brings up another issue (#4122), but ignoring that for now, the code fully executed despite not having any valid targets in line 4.Screenshots
No response
MapTool Info
1.14.0-alpha1
Desktop
Windows 10
Additional Context
No response
The text was updated successfully, but these errors were encountered: