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
The JSON viewtool does not support valid JSON types, only strings #21529
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Second ticket reporting this: https://dotcms.zendesk.com/agent/tickets/112876 |
…payload (#25832) Co-authored-by: erickgonzalez <erick.gonzalez@dotcms.com>
Note for testingThe conversion of the map of parameters to a json sent as payload in the post request should be tested with this overloaded method that was added to the json view tool:
For example, this VTL code can be used:
The call above should return successfully:
|
Describe the bug
The JSON viewtool does not support valid JSON types.
Valid JSON types are as follows:
a string
a number
an object (JSON object)
an array
a boolean
null
Currently, our implementation only accepts
Map<String, String>
meaning that the JSON tool will only accept string values. This causes issues if the receiver is expecting different types.https://github.com/dotCMS/core/blob/master/dotCMS/src/main/java/com/dotcms/rendering/velocity/viewtools/JSONTool.java#L195
Reproduced on: Latest, 5.3.8.X
To Reproduce
Create a VTL with a call to an API that has non-string values, and attempt to fire it, for example
Expected behavior
Our implementation should be able to handle any valid JSON types
The text was updated successfully, but these errors were encountered: