'Convert ArrayList<Custom> to gson in Java Android
Good afternoon. I can not understand why the code does not work after publishing in the Google market. Before publishing in android studio code
ArrayList<TableAccount> tableAccount = getTableAccount();
String jsonStr = new Gson().toJson(tableAccount);
result:
Log.d(TAG, "RESULT: " + jsonStr);
RESULT: [{"name":"payment","valueFloat":0.0,"valueInt":0,"valueStr":"no"}]
But, after posting, I see:
Log.d(TAG, "RESULT: " + jsonStr);
RESULT: [{"a":"payment","b":"no","c":0,"d":0.0}]
Why do the letters a b c appear?
And where do the keys disappear? ["name", "valueFloat", "valueInt", "valueStr"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
