• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help with Json Parser  RSS feed

 
Shiny Suresh
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to JSon.
The value I have in 'jsonUtilityData' is {"data":{"SOURCE_CODE":[{"srtSeqNbr":200,"attrNm":"SOURCE_CODE","attrValCd":"SRC_CD","attrValNm":"BlueChip","attrValDesc":"SOURCE OF DATA IS BLUECHIP","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":" ","valListLstUpdTs":1369928264641},{"srtSeqNbr":202,"attrNm":"SOURCE_CODE","attrValCd":"SRC_CD","attrValNm":"HMO","attrValDesc":"SOURCE OF DATA IS HMO","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":" ","valListLstUpdTs":1369933147428},{"srtSeqNbr":203,"attrNm":"SOURCE_CODE","attrValCd":"SRC_CD","attrValNm":"Prime","attrValDesc":"SOURCE OF DATA IS Prime","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":" ","valListLstUpdTs":1369933173533},{"srtSeqNbr":204,"attrNm":"SOURCE_CODE","attrValCd":"SRC_CD","attrValNm":"Megellan","attrValDesc":"SOURCE OF DATA IS Megellan","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":" ","valListLstUpdTs":1369933203697}],"CORP ENT CODE":[{"srtSeqNbr":1,"attrNm":"CORP ENT CODE","attrValCd":"CORP-CD","attrValNm":"IL1","attrValDesc":"ILLINOIS","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":"JANE ","valListLstUpdTs":1365102144000},{"srtSeqNbr":2,"attrNm":"CORP ENT CODE","attrValCd":"CORP-CD","attrValNm":"TX1","attrValDesc":"BLUE CROSS BLUE SHIELD OF TEXAS","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":"I317464 ","valListLstUpdTs":1363817148102},{"srtSeqNbr":3,"attrNm":"CORP ENT CODE","attrValCd":"CORP-CD","attrValNm":"NM1","attrValDesc":"BLUE CROSS BLUE SHIELD OF NEW MEXICO","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":"I317464 ","valListLstUpdTs":1363817148102},{"srtSeqNbr":4,"attrNm":"CORP ENT CODE","attrValCd":"CORP-CD","attrValNm":"NM2","attrValDesc":"NEW MEXICO HMO","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":"I317464 ","valListLstUpdTs":1363817148102},{"srtSeqNbr":5,"attrNm":"CORP ENT CODE","attrValCd":"CORP-CD","attrValNm":"OK1","attrValDesc":"BLUE CROSS BLUE SHIELD OF OKLAHOMA","dfltInd":"N","actvInd":"Y","valListLstUpdUsrId":"I317464 ","valListLstUpdTs":1363817148102}]},"total":0,"start":0,"sort":null,"order":null,"size":2}

I need to parse this string into a Map. But I am getting this exception. JSONObject["data"] is not a JSONArray. The Map is expected to have 2 Lists . The keys for the map are SOURCE_CODE and CORP ENT CODE.
Can anyone help me with this? Any help would be appreciated.





Thanks,
Shiny Suresh.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might help to let us know which JSON parser you are using.
 
Shiny Suresh
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I fixed the issue. I used JSONArray and parsed the json object. then assigned the content of Json array into 2 lists and set them in a map. Thanks for your prompt response. Appreciate it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!