Firstly, an API Object is just a JSON blob of a single object, so rather than dealing with a single field that is of type text that is a JSON array (the main reason publicly addressed as to why we have WU pricing is because people were doing this and causing strain on Bubble resources with expensive fetches), with API objects you are dealing with a field that can be a single ‘thing’ (ie: a real data type that is called API Object that is part of default Bubble - Bubble has four data types, custom data types, option sets, API Objects and Plugin types; Plugin types are basically just API objects that are programmed into the plugin) or a list of ‘things’ (ie: a list of api objects).
So just based on that alone, your answer for your real question based on what you say is your real goal here:
You should make the smart decision and use API Objects instead of just a JSON array as text
NOW, what you need to be able to discern then is ‘when should I use API Objects instead of custom data types?’, which takes some thought into ideas around
- how the data is created
- how the data is fetched
- by who is the data fetched
- how often is the data modified
- how often is the data fetched
Those five questions can help you decide ultimately if using API objects instead of custom data types provides any type of benefit to you. Then you need to ask yourself WHY do you want to use them to begin with, which is usually for two potential purposes:
- Save WUs
- Improve UX through faster data loading and pagination
Then you can begin to ask yourself if the way in which the data is created/modified going to benefit from improved UX through advanced features mostly only attainable through use of API objects, and if you as developer want easier ways to extend your applications functionality with things like Local Storage, Index DB, integrations with AI etc. since the use of API Objects is basically just a better way to store JSON in Bubble database and the internet is powered and communicates through JSON.
Then to the point of the “omniscient“ predictor of answers (ie: the thing that makes best guess analysis based on prior knowledge - so outdated second hand accounts)
- You can search/filter and query it server-side like real data, you just need tools to do so. So once you get your list of API Objects into your data source running your backend workflow you can then run searches, filters etc. over that list of objects.
- In terms of building indexes, you can do that in several ways, one of which is to really leverage a Hybrid Data Structure approach in which custom data types have fields that are your index keys and the API Objects are stored on another field as a list - there are other ways to but you really do not need to worry as if you are making the correct decisions around when and why to use API Objects, you are not going to be dealing with more than a few thousand things at the same time.
- In terms of privacy rules, you can, similar to indexing, where you put fields onto custom data types to leverage bubble privacy rules. Additionally, since they are so cheap, you can just create other objects that have the private keys and value pairs removed for an additional layer of security.
- If you are using API Objects as a list, you can if you have the right tools to modify one object, remove it from the list and add it back to the list, or you could be ridiculous like an LLM and just replace the entire blob, but that would be a bit daft.
- Don’t believe everything you see on the forum, it is like Youtube, lots of people put out content that are giving bad advice. Sometimes people say things that just are not within their wheelhouse of knowledge and experience and they put out concepts and ideas that are just not aligned with reality…So, YES, you can most definitely search, modify and create API Objects with the right tool. Data Jedi Plugin does this incredibly well, and in a NoCode approach that is just like native Bubble.
- This is not accurate about the Schema…if you update your schema by adding new fields, nothing breaks, just the existing blobs have empty fields. If you change the names of the fields, nothing breaks, you just need to update where you parse the API Objects (again you need a tool like Data Jedi to do this well, or some other free plugins that do similar things might possibly also work) so the fields are lined up properly. But at the end of the day, it is up to the competent developer to remember things like the schema and not make changes if not necessary, and know where to make the changes, meaning should you inform OpenAI to change the schema to match the existing API Object schema inside the bubble app, or should you change the API Object schema (smart money is on the inform OpenAI to change schema side of the bet).
- Yes, it is easy to overuse, this is why a developer needs to think first about said questions on why and when to use them.
But at the end of the day, your post was about the choice between JSON and API Objects, not a difference between API Objects and Custom Data Types, so rest assured, your concern is clearly answered, that API Objects are the far superior choice over JSON.