Remove value from JSON array


I found out that you can append a value to the end of a JSON array: Updating JSON Data - Backendless REST API Documentation
In the example above “Yellow” is added at the end of the array. How would I go about removing “Yellow” from the array again? The ideal solution would let me say “remove the string that matches ‘Yellow’”. Maybe someone has an idea of how to do that or something with the same result.

Thank you very much in advance. Let me know if you have any questions.

I think SQL does only understand a generic REMOVE command like the one described in your referenced Backendless REST API documentation. You need to know the exact path to that element for using this command. You can try using JSONSEARCH to get the right path to the “Yellow” entry for removal. Please let me know if this works, because I have a similar problem in front of me and that is my expected solution right now. :wink:

Hi Jörg,

I really appreciate the answer. It’s unfortunate that there is no clean way to do this. I tried your solution but as far as I can see JSONSEARCH only returns the object. Did you build a cloud function that searches the array, creates a new array without the desired string, and replaces the old one with that updated array to the initial position again? That’s the way I would think it would work but it feels overly complex.


Does maybe someone from the team have an idea of how to achieve this?

Hello @Jorg_Beyer

You can’t modify JSON in the database with these JSON methods.
You should retrieve a record with JSON data, modify it, and then save it.


@viktor.liablin I think we are talking about the same. I am talking about a database column of type JSON. For this particular JSON data entry the data manipulation should be implemented and then saved back to the database. But the JSON string can be somewhat complicated and nested.