The point is, clearly, that your data is not a JSON array.
{"data1":"100","data2":"hello"}
It is, instead, a JSON object, but you are trying to parse it and get a JsonArray
. You could change this and use getAsJsonObject()
instead, but from your code I think it's your starting data that is wrong. I guess you should have an array of employees, so the correct data should probably be something like:
[{"data1":"100","data2":"hello"}]