This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

passing response as json vs. string array

 
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.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • 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
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!