-4
I would like to know how to save a key and value Arraylist in the database using Java;
I had already made an implementation earlier in php similar,
whose I created the array and used the function json_encode($array)
to transform the array into a string and json_decode($array_string)
to convert the string to an array.
I would like to know a similar method that you can use in Java, remembering that it is a key-value array.
Battered.
Could [Edit] the question with examples of data that are in the
ArrayList
? I say this because in PHP an array can be either a sequential list or a set of key/value pairs, but in Java the structures are separated:ArrayList
is only a list of elements, and for key pairs/value is usedMap
. Anyway, the best way to write to the bank will depend on how the data is. Not always turning into a JSON is the best solution, but without knowing how the data is, can not help much...– hkotsubo