I need some help here. I am still new in android developer.
Here is example of the data
strAPI_TERMINAL= "{ 'terminal': { 'id': 2, 'fmt_id': 'fmt0002', 'terminal_type': 'multiple' }}"
I need to parse this object data to JSONArray
Here what i ve done...
JSONObject jsonObject = new JSONObject(strAPI_TERMINAL);
JSONArray terminal_array = new JSONArray();
JSONArray t_array = terminal_array.put(jsonObject);
When I Log out the data...yes it has been parse to array just like this
t_array[{"terminal":{"fmt_id":"fmt0002","id":2,"terminal_type":"multiple"}]
But When I wanna use it to get the "terminal" data using this...
JSONArray TERMINAL_JSON=new JSONArray(t_array.getJSONObject(i).getString("terminal").toString());
It says:
Error:Value {"id":2,"fmt_id":"fmt0002","terminal_type":"multiple"}
Anyone please help me???
thanks for any help...