Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to generate an JSON object in a JSON Array oin Spring Rest Web Service Design?  RSS feed

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am designing a REST JSON Web Services using Spring Controller.My Requirement is I want to generate a JSON response as
JSON Object then JSON Arrays inside it.
JSON Array then JSON objects inside it

this is my code that I am using


where EmployeeGeneralInfo is a Model class

and I am getiing response like this

{"empFirstName":"Kishor","empEmail":"kishorjoshi120@gmail.com","empMob":"phone","empCategory":"Employee","empDept":"Tech","empSubDept":"IT","empImage":"YWJjLmpwZWc="}


What I want something like this
{
"myfirstObject"
[
"attribute":"value1"
"attribute2":"value2"
]
,
[
"attribute1":"value1"
"attribute2":"value2"
]
}

something like this which we use in JSONObject jsonObject=new JSONObject() like this notation

Is it possible to construct like this JSON in Spring REST?

Thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Maneesh

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!