This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2, How to populate this object with json Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2, How to populate this object with json" Watch "Struts2, How to populate this object with json" New topic
Author

Struts2, How to populate this object with json

Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19

I have this question:

How to populate this object from a struts2 action. My action populates without any problem a lot of my objects, but I have a restriction on a JSON input. My input is like this:

I don't now how to populate...The class geometry can have a double[] or double[][] or double[][][] because the JSON input can have multiple geometry types. Json examples:



And my object is this:



If I modify my geometry class to double[] coordinates...it works, but only with point geometry...

I use struts2 2.1.8 with json plugin.

Many thanks
Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19
Hi at all,

Anybody has idea how to solve this question?

My object to populate has type object, and I think taht JSON parser don't have idea to parse this...Can a do an interceptor to parse this propety first?

Any suggestion?


Many thanks!
 
Have you checked out Aspose?
 
subject: Struts2, How to populate this object with json
 
jQuery in Action, 3rd edition