In an event script on a view component, I have an INSERT query that I run with system.db.runPrepUpdate. One of my columns in the table I'm inserting rows into is a BLOB type, and I would like to store JSON objects in it.
My trouble is that when I run the query, this blob column does not contain the JSON object I pass as an argument into the runPrepUpdate function. Instead, it contains some odd value that looks like an array with a serialized value in it:
Additionally, whenever I run a SELECT query on this column, the serialized value changes.
I am not sure what is causing this and how to prevent it. Any ideas?
That's the stringified form of a byte array in java. It appears different because java makes a new array to hold the content on every query, and the "address" is part of the stringification.
Changing the column type to TEXT did the trick, thanks for the advice.
What's odd to me is that I'm also converting an array to a JSON object and inserting it into the same table (different BLOB column), and the JSONed array is stored as inserted.
Not sure why there's a difference between these two cases besides the fact that one JSON object was originally an array and the other was an object/dictionary.