Win a copy of Microservices in Action this week in the Web Services 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Sending & receiving 2d arrays from jersey to javascript  RSS feed

 
Ranch Hand
Posts: 205
13
Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a 2 dimensional array of strings in javascript, ie an array of arrays, that I'm wanting to fill with data that I GET from the server, update in javascript code and then PUT back.

It seems that to do this in Jersey, in my java code, I have to wrap the array in an object.


and make the object wrapping my String[][] available via http

When my String[][] looks like this:

doing a GET on the resource results in

Then, in my javascript code, I have to have functions that 'unwrap' the json into an array. Another js function does the opposite, takes a 2d array and returns an object that can be PUT back to the server.


This all works! However, I'm thinking that manually wrapping & unwrapping is just too much work and maybe jersey is somehow capable of doing it for me.

Is there a better technique?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!