I have a very big constant JSONArray coming from Webservice, in order to reduce data transfer, I wanted to put it in Android. I logged all JSONArray(coming from webservice), put it inside a string and converted to JSONArray. Here is the code I wrote :
String additionString = ""Additions":[{"AdditionID":0,"Type":-1,"Long":" ","Short":" "},{"AdditionID":8,"Type":6,"Long":"English,"Short":"Eng"},{"AdditionID":11,"Type":2,"Long":"French","Short":"Fr."},{"AdditionID":12,"Type":2,"Long":"German","Short":"Ger."}]";
JSONArray AdditionArray = new JSONArray(additionString);
And I'm getting this error for that :
Value Additions of type java.lang.String cannot be converted to JSONArray
By the way, the string looks like this in Android Studio :
String additionString = "\"Additions\":[{\"AdditionID\":0,\"Type\":-1,\"Long\":\" \",\"Short\":\" \"},{\"AdditionID\":8,\"Type\":6,\"Long\":"English,\"Short\":\"Eng\"},{\"AdditionID\":11,\"Type\":2,\"Long\":\"French\",\"Short\":\"Fr.\"},{"AdditionID":12,"Type":2,"Long":"German","Short":"Ger."}]";
How can I convert that String to JSONArray? Thanks.