-6

I have,

[{"GroupPosition":0,"ChildPosition":0},{"GroupPosition":0,"ChildPosition":1},{"GroupPosition":1,"ChildPosition":0}]

How do I split them into: GroupPosition:

[0,0,1] or {0,0,1}

ChildPosition:

[0,0,0] or {0,0,0}
Yuliam Chandra
  • 14,494
  • 12
  • 52
  • 67
Brick Brr
  • 87
  • 6
  • [JSON Parser](http://www.tutorialspoint.com/android/android_json_parser.htm)? –  Aug 24 '14 at 04:49
  • @Yuliam Chandra, thanks for edited my topic which helped me completed my goal. Thanks and thanks – Brick Brr Aug 24 '14 at 18:01

1 Answers1

0

Your input is in json format. Consider my code is sample.

private static ArrayList<String> array_1 = new ArrayList<String>();;
String json = [{"GroupPosition":0,"ChildPosition":0},{"GroupPosition":0,"ChildPosition":1},{"GroupPosition":1,"ChildPosition":0}];
JSONArray leagues = new JSONArray(json);
for (int i = 0; i < leagues.length(); i++) {
JSONObject obj = leagues.getJSONObject(i);
array_1.add(obj.getString("GroupPosition"));
}
Amsheer
  • 7,046
  • 8
  • 47
  • 81
  • Thanks alot Amsheer. It's very close to what I wanted. You are truly one of the greatest people. OUCH, I didn't know there was a topic like this already since I am still new to Android and didn't know what it was called... PARSE got it. -7 to my account WOW – Brick Brr Aug 24 '14 at 17:57
  • negative positive vote doesn't matter. When you ask question here just explain what is your problem. what are all the things you tried. That will helps you. – Amsheer Aug 25 '14 at 05:46
  • For developing android application 90% of people use json . But most of the people doesn't understand your question. Keep try. Good luck – Amsheer Aug 25 '14 at 05:49