Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing response as json vs. string array

 
Shashank Sharma
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.
I am working on a client server architecture application. for which I am using Restlets Clients Response and Http Connector For Remote procedure Call.
I want to pass two objects as response.
so I am creating json for both using Jakson object mapper.



now In order to pass it to the client I can
a)pass the above two json string as a string separated with a delimiter like'~'
b)pass a string array having two of these json strings.
c)create a json having two of these json strings its content //not able to implement.
d)send a restlet object

I really dont wana use a) there can be chances that my string contains the delimiter as the content value.
b)am facing a parsing error....
c)it is working fine for me... need to figure if there is any chance of data loss.
d)heavy response... want to avoid....and want to reduce no of client -server calls.

would like to know you comment on the above mentioned procedures for sending response.


Thanks for your time reading this post.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer depends on the response content-type you want to have. If you are specifying application/json they you have to return a json string, so option c) is the correct choice. I am not sure what kind of data loss are you talking about in this case.
 
Shashank Sharma
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nitesh,

So far option c i.e creating a JSON of a String arrays having JSON as content works for me. For 'data loss' i mean chance of my json breaking up due to the type of content. as there will be a lott of data being passed as json string.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic