this is the first time Im working with a JSON database (Realtime Firebase DB in Android app) and Im having issues to convert common 2 field primary key SQL data to a JSON structure.
This is the table:
And these are the rows I have to store:
USUARIO;ID_TRX
aaa;444
bbb;444
bbb;555
Im converting those rows to:
{
"RL_USR_TRX": {
"aaa": [
{
"ID_TRX": 444
}
],
"bbb": [
{
"ID_TRX": 444
},
{
"ID_TRX": 555
}
]
}
}
When I manually upload this file to Realtime DB, I see it like this, with an unique parent node per same USUARIO:
Then, I dont know how to read data USUARIO=bbb and ID_TRX=555, as I dont know the parent node of ID_TRX=555 which in this case is 1.
I know I have problems in this approach, I read official docs and much more but cant figure out right how should I think this. Any help please?