Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8240429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:29:26+00:00 2026-06-07T20:29:26+00:00

I am working on Play framewrok 2 with websocket and JsonNode . the front

  • 0

I am working on Play framewrok 2 with websocket and JsonNode . the front end is connected to the play framework backend by use of websocket. I converted a javascript array into a json node and sent it to the backend by the use of the webscoket connection.
Now my problem is how do i convert the json object into a a java array or any suitable structure so that i can manipulate the data.

this is the json object I created

var myjeson = {"x":arrayX,"y":arrayY} ;

this is the array which is populated dynamically

 function pixelCount ()
    {  arrayX[counter] = xcoordinate;        
    arrayY[counter] = ycoordinate;
    socket.send(" from array X,Y  "+arrayX[counter]+ " " +arrayY[counter]); 
    ++counter;      
    }

the code below sends the data

$('button.send').click(function() {            
sock.send(JSON.stringify(myjeson)); 

on the server side i have the following code

 public static WebSocket<JsonNode> givenIn() {
    return new WebSocket<JsonNode>() {
    // called when the websocket is established
    public void onReady(WebSocket.In<JsonNode> in, WebSocket.Out<JsonNode> out) {
    // register a callback for processing instream events             
    in.onMessage(new Callback<JsonNode>() {
    public void invoke(JsonNode event) {                 
    Logger.info(event.toString());
    }

when I check the log the message is delivered :
below is the log info
[info] application –

{"x":
[78.72727298736572,79.72727298736572,82.72727298736572,
7298736572,93.72727298736572,83.72727298736572132.72727298736572],

"y":
[82.6363639831543,82.6363639831543,63.54545593261719,63.54545593261719,64.545455932
61719,65.54545593261719,70.54545593261719,189.5454559326172,188.5454559326172]}

Now I will like to place these data in an array so that I can access them.
any suggestion will be appreciated.an alternative suggestion is also welcomed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:29:29+00:00Added an answer on June 7, 2026 at 8:29 pm

    The answer is mostly in the Jackson documentation and the tutorial;

    you have several ways to transform that JsonNode into useful data.

    If you know in advance the structure of the data you can use the Data Binding approach: for “full” binding make a Class corresponding to all fields); For a less structured approach the ‘raw’ binding let you use generic objects.

    Otherwise the Tree Model approach should work for you; the example you will find in the linked page corresponds quite well to your use case.

    Please try that example, then if you have more specific issues come back with the exact practical or phylosophical issues!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'me working on a web server using play framework 2.0, where the login is
RoR newbie here. Working the play time exercises at the end of Agile Web
I've been working on a Play framework social networking application, and I've come across
I wonder if any of you out there working with the Play Framework, has
I'm working on my first website with the Play! framework, and at one point
I've been experiencing a strange error while working on my Play Framework project. While
Im working on a project where i need to use socket.io at client end
I'm working on a 1.2 Play! framework application, and I have a problem when
I am working on Play Framework 2.0 and it uses Jerkson to parse JSON
I am using the Secure module from play framework and its mostly working great.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.