Join the Webstudio community

Updated last month

Convert text to a number

At a glance
Hey everyone, I've got this JSON in a resource using POST:

{
"currency": "USD",
"filtering": {
"destination": "55",
"tags": ["$system.search.experience"]
},
"pagination": {
"start": 1,
"count": 20
}
}

But get this error back from an API:

{
"ok": false,
"data": "Cannot deserialize value of type java.lang.Integer from String "$system.search.experience": not a valid java.lang.Integer value\n at [Source: REDACTED .........

So sounds like I need it to be an integer when it's a string. After multiple hours I cannot seem to get the right JSON to convert it into a number that the API will recognise

If I replace the system.search variable with a static number it works fine.

When I try {
currency: "USD",
filtering: {
destination: "55",
tags: [parseInt($system.search.experience)]
},
pagination: {
start: 1,
count: 20
}
}

It says "Functions are not support"

I wonder what I can do to get this into a number format?
Attachment
Screenshot_2025-03-23_103142.png
O
R
5 comments
you seem to be sending "$system.search.experience" instead of the actual number, check your template string in the binding
In such cases you need to provide full information if you need to get a better answer
Thanks, when I put it in backticks I get this error
Attachment
image.png
Ah got it
Attachment
image.png
Working now! Thanks so much for the responce @Oleg Isonen your comment got me on the right track
Add a reply
Sign up and join the conversation on Discord