Hi Ola, I see you asked this on SO also [1] and then self-answered that you have a workaround. So I presume this is no longer an issue for you.
But to answer it here: I think the error you're getting back is pretty clear: "value" needs to be a string, not a JSON object. You'll need to convert the JSON to a string within your javascript, see for example JSON.stringify(), [2] Dan [1] http://stackoverflow.com/questions/22766621/angularjs-json-isis-cant-retrieved-json-data-in-restful-object-server-as-stri [2] http://stackoverflow.com/questions/3593046/jquery-json-to-string On 31 March 2014 14:52, Tomoloju, Ola <[email protected]> wrote: > Good day Dan, > > I am going working on option highlighted below .i.e define > the last parameter as a simple string, and then do the parsing of the JSON > server-side within your action. But I am getting the following error. > > > > "invalidReason":"Failed to parse representation as value of type > 'String'"},"x-ro-invalidReason":"Basket Item is mandatory"} > > > > JSON Request sent to RO Server > > var basketItem= { X:x1, y:y1 }; > > > > var basketItemByStop= > > { > > > > sessionId > : { > > > id : "sessionId", > > > memberType : "property", > > > value : '3432345ADC' > > }, > > customerId > : { > > > id : "customerId", > > > memberType: "property", > > > value : '123456' > > }, > > email : { > > > id : "email", > > > memberType : "property", > > > value : "[email protected]" > > }, > > basketItem > : { > > > "id" : "basketItem", > > > "memberType" : "property", > > > "format" : "string", > > > "extensions" : {"x-isis-format" : "string"}, > > > "value" : basketItem > > } > > }; > > > > My action method defintion > > > @Bookmarkable > @ActionSemantics(Of.IDEMPOTENT) > @MemberOrder(sequence = "1") > @Named("View Basket - rich client") > @PublishedAction > public final ShoppingBasket getBasket( > @Named("Session ID") final String sessionID, > @Named("Customer ID") final String customerID, > @Named("Email") final String email, > > @Named("Basket Item") final String newTravelCardDetailsJSON) { > > } > > > > The main problem is the newTravelCardDetailsJSON parameter is coming > across as [object object] in the method and using toString() does not > convert it to a normal string. > > I need it as a normal human readable json and pass it to my Jackson JSON > parser for further processing. > > Please, how to a go about it this. Setting the format in my angular > controller script above is not working. > >
