I am parsing the json array and fetching the result. I want to store the json array values to string array.
Here is my code:
public static void main(String[] args)
throws JSONException, IOException, URISyntaxException
{
String[] Stage_Probability;
JSONArray stagearray = x.getJSONObject(j).getJSONArray("val");
Map<String, String> test2 = new HashMap<String, String>();
for (j = 0; j < stagearray.length(); j++)
{
test2.put(stagearray.getJSONObject(j).getString("pbty"), stagearray.getJSONObject(j).getString("sortorder"));
System.out.println("----" + stagearray.getJSONObject(j).getString("pbty"));
Stage_Probability[j] = stagearray.getJSONObject(j).getString("pbty").toString();
}
}
It prints null. Any help will be appreciated.