-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: When parameter "value" is json string, JsonParser should convert json string to Object directly. #4003
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
Conversation
@bourne7 Could you add a unit test to verify these changes? in |
sure |
sy, i find that this problem has been fixed in this commit: 18ae16e Ahmed Maruf 81756975+ohmaruf@users.noreply.github.com on 2025-05-27 at 16:56 |
5b10240
to
b7fd600
Compare
Additional improvements: modification on 05-28 added isValidJson method, it actually attempts deserialization to determine if the string is JSON type. In fact, this could be optimized - change it to immediately return the object if successful, avoiding double deserialization. In most cases, Model returns a JSON string, so this optimization can eliminate one deserialization step in the majority of scenarios. |
We still need a unit test to validate the changes. |
… when parsing Model response Signed-off-by: bourne7 <lawrencepbr@gmail.com>
@sobychacko unittest added ;) |
This comment was marked as outdated.
This comment was marked as outdated.
… when parsing Model response (spring-projects#4003) Fixes spring-projects#4003 Auto-cherry-pick to 1.0.x Signed-off-by: bourne7 <lawrencepbr@gmail.com>
… when parsing Model response (spring-projects#4003) Fixes spring-projects#4003 Auto-cherry-pick to 1.0.x Signed-off-by: bourne7 <lawrencepbr@gmail.com>
when parameter "value" is json string:
current code will convert it to json string with escaped quotes:
following code will fail to parse it from escaped json string to object.