Sabitha
Sabitha

Reputation: 283

Convert String containing comma separated JSONObjects to JSONArray

I have a String which contains many JSONObjects. I need to convert that String to JSONArray. Please help.

""{\""Name\"":\""name1\"",\""Age\"":\""20\"",\""S.No.\"":\""1\""},
 {\""Name\"":\""name2\"",\""Age\"":\""21\"",\""S.No.\"":\""2\""},
 {\""Name\"":\""name3\"",\""Age\"":\""22\"",\""S.No.\"":\""3\""}""

Upvotes: 2

Views: 2576

Answers (2)

SakthiSureshAnand
SakthiSureshAnand

Reputation: 1362

There is Java Lib called Quick-json - A java library to convert json string to java objects & java objects to json string. parse/generate json the way you want quickly. configure/validate json at every level.

Please refer for Quick- Json Lib https://code.google.com/p/quick-json/ has good example's as well as explanation.

Upvotes: 0

Thilo
Thilo

Reputation: 262684

Wrap the string in "[]" and then use the JSON parser of your choice.

Upvotes: 4

Related Questions