How to cut the number of characters in a custom state from JSON?

Hello everyone! Maybe I ask too many questions, but I really try to do it myself for a long time first, and then I ask for your help.

I get list of reviews via API. Then they are passed as text to a custom state. I figured out how to limit the number of reviews and how to limit the number of characters in each review as well.

To get 10 feedbacks, I use this:

 "feedbacks": [
            "id": "YkO9S5RsfI6MmMOwkhEc",
            "globalUserId": "28068746",
            "wbUserId": 28064338746,
            "wbUserDetails": {
                "name": "Name",
                "country": "ru",
                "hasPhoto": false
            "nmId": 14865718410,
            "text": "Some text some text some text some text some text some text some text some text some text some text some text some text some text ",
            "pros": "",
            "cons": "",

But I need to create some trim so that no more than 90,000 characters are passed to the custom state in total. How can I do this?

Hey @zzsnowballzz :wave:

You can continue the expression after ....:items until #10 something like below. Simply, if you want 90,000 characters in total, that means each review should be 9,000.

....:items until #10 : format as text : split by (||).

In the format as text, you will simply truncate each item and merge them with something unique (I chose ||) and then split by these.

I hope this helps.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

Thanks for wanting to help. The thing is, I have different tiers in my SaaS. For example, in the first tier, you can parse up to 100 reviews. In the maximum tier, you can parse an unlimited number of reviews, but the total number of characters should not exceed 90,000 characters.

I can’t trim each review to make this happen, because I need the full reviews for analysis, without cutting them off.