I have to parse the following data
{"ResultSet":{"Query":"microsec fin","Result": [{"symbol":"MICROSE_a.NS","name": "MICROSEC FIN SERV LTD ","exch": "NSI","type": "S","exchDisp":"NSE","typeDisp":"Equity"}, {"symbol":"MICROSEC.NS","name": "Microsec Fin Serv Ltd","exch": "NSI","type": "S","exchDisp":"NSE","typeDisp":"Equity"}]}} The code i am using is
JSONObject json = (JSONObject) JSONSerializer.toJSON(inputLine); symbol=json.getJSONObject("ResultSet").getJSONArray("Result").getJSONObject(0).getString("symbol"); which returns MICROSE_a.NS. What i want to do is if there is an undersore in symbol then i want the next symbol to be taken. That is now i want symbol to actually hold MICROSEC.NS. How do i do this.