In the console, my JSON format looks like
{
“Saad Zahoor”: “jk: (1599694066936)”
}
but when I fetch the json data type into app and store it into string I get different format String getJSON = response.get(0).getChat().toString(); {rawJsonString={"Saad Zahoor": "hi: (1599694233936)"}, ___class=com.backendless.persistence.JsonDTO}
and when I parse it, it says No value for Saad Zahoor
What is the proper way to fetch the JSON data type from the backendless??
I am talking about your Java class. You said it has a field/property called chat. My question is what is the data type of that field/property? For example, is it Object, String, HashMap ?
Try changing it to HashMap. The system doesn’t like the JSON field name Saad Zahoor for the reason that it is not a valid java property name (because of a space in the key name). Changing to HashMap might solve the problem.
After upgrading to 6.0.1 from 5.2.4 the response from the backenedless crashes
In version 5.2.4
when i call this below code
DataQueryBuilder queryBuilder = DataQueryBuilder.create();
queryBuilder.setWhereClause(whereClause);
Backendless.Data.of(PassengerChauffeurConnection.class).find(queryBuilder, new AsyncCallback<List<PassengerChauffeurConnection>>() {
@Override
public void handleResponse(List<PassengerChauffeurConnection> response) {
if (response.size() == 1) {
String didChauffeurAcceptTheRide = response.get(0).getRideAcceptedByChauffeur();
String didPassengerAcceptTheRide = response.get(0).getRideAcceptedByPassenger();
}
@Override
public void handleFault(BackendlessFault fault) {
}
});
At line where I am getting result from backenedless String didChauffeurAcceptTheRide = response.get(0).getRideAcceptedByChauffeur();
In 5.2.4 version, it simply gives me the value that is store in the backendless
After converting to the new version
I am getting an error
java.lang.ClassCastException: java.util.HashMap cannot be cast to com.saadBinZahoorOfficial.slipslop.Backendless.PassengerChauffeurConnection