0

i need parse data from supplied json feed:

{
  "notes": {
    "data": [
      [
        "281616",
        "AVD NOTE"
      ],
      [
        "286490",
        "TEST NOTe"
      ]
    ]
  },
  //...//
}

I have actually this code (shorted):

if (jParser.nextToken() == JsonToken.START_OBJECT) {
    while (jParser.nextToken() != JsonToken.END_OBJECT) {
        switch (jParser.getText()) {
            case "notes":
                jParser.nextToken();
                while (jParser.nextToken() != JsonToken.END_OBJECT) {
                    switch (jParser.getCurrentName()) {
                        case "data":
                            while (jParser.nextToken() != JsonToken.END_ARRAY) {
                                while (jParser.nextToken() != JsonToken.END_ARRAY) {
                                    android.util.Log.e("val", jParser.getText());
                                }
                            }
                            break;
                        default:
                            jParser.nextToken();
                    }
                }
                break;
        }

But this while (in case "data", while not working correctly) (rest of the code works correctly) , I need write val: (281616), val(286490) etc after new line to console. Please help me with code.

  • check this http://stackoverflow.com/a/18998203/2277289 – suraj.tripathi Oct 02 '16 at 10:10
  • 1
    Possible duplicate of [How to parse JSON in Java](http://stackoverflow.com/questions/2591098/how-to-parse-json-in-java) – Stuart Siegler Oct 02 '16 at 10:12
  • Ok, I know some people want to brag about their java keyword knowledge, but it's not the case here. Why are you using `switch` statements where a single `if` statement would be considered a bad coding habit? – Adrian Jałoszewski Oct 02 '16 at 10:12
  • 1
    @AdrianJałoszewski - I use switch, because this code is shortened. I have approx. 10 cases, but i dont copy to this question. – Lucie Grep Oct 02 '16 at 10:20
  • In suggested question, i dont see, how to parse two dimensionall array. There is only array and object, but i need array in array parse. – Lucie Grep Oct 02 '16 at 10:23

0 Answers0