• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to split my json object

 
anji anjaiah
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

Please find below my JSON object ,how can we split

[
{"alpha2Code":"AF",
"alpha3Code":"AFG",
"altSpellings":"AF, Afganistan",
"area":652230.0,
"callingcode":"93",
"capital":"Kabul",
"currency":"AFN",
"gini":27.8,
"isoNumericCode":"4",
"languages":["ps","uz","tk"],
"latlng":[33.0,65.0],
"name":"Afghanistan",
"nationality":"Afghan",
"population":25500100,
"region":"Asia",
"relevance":"0",
"subregion":"Southern Asia",
"timezones":["UTC+04:30"],
"topLevelDomain":".af",
"translations":{"de":"Afghanistan","en":"Afghanistan","es":"Afganistán","fr":"Afganistán"}
}}]

I need it should be split & Write Java code by JSONArray and JSONObject

Thanks
AnjaiahSpr
 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could construct a BufferedReader to contain the JSON input and make a String out of it and then construct a JSONObject with it.

Sample:


There are different parsers available you can use as well.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!