Hi Guys,
I'm trying to get familiar working with GSON and have attempted the following:
output out = new output();
out.aaData.add(row0);
out.aaData.add(row1);
Gson gson = new Gson();
String json = gson.toJson(out);
System.out.println( json );
**************************************
public class output{
public String id = "";
public String error = "";
public ArrayList<FieldError> fieldErrors = new ArrayList<FieldError>();
public ArrayList<String[]> data = new ArrayList<String[]>();
public ArrayList<String[]> row = new ArrayList<String[]>();
public ArrayList<String> aaData = new ArrayList<String>();
...
}
The output for this winds up being:
{"id":"","error":"","fieldErrors":[],"data":[],"row":[],"aaData":[
I expected the escaped character "\" to disappear and just leave the double quote, but it didn't. The format must be: "field_name":"field_value" . I even tried escaping the escape character with \\" and even \\\". None of these worked. What do I need to do to get the format I want? Please advise.
Alan