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 7843673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:37:28+00:00 2026-06-02T16:37:28+00:00

I am have a trouble with the data format problem. I have a simple

  • 0

I am have a trouble with the data format problem. I have a simple JaxB Class

@XmlRootElement(name="")
public class MyProgressResponse {
    private int weight;
    private long date;
    /**
     * Weight is treated as a Y Axis.
     * @return
     */
    @XmlElement(name="y")
    public int getWeight() {
        return weight;
    }
    public void setWeight(int weight) {
        this.weight = weight;
    }
    /**
     * This is a UTC format of a time.
     * value is a number of milliseconds between a specified date and midnight January 1 1970
     * This is also treated as a X-Axis
     * @return 
     */
    @XmlElement(name="x")
    public long getDate() {
        return date;
    }
    public void setDate(long date) {
        this.date = date;
    }
}

And I want the REST service that fill that returns the data. like this

@GET
@Path("/my")
@Produces(MediaType.APPLICATION_JSON)
public MyProgressResponse[] getProgressResponse(){
    // Get the data from DB
    // Here the getDate will give me List<MyProgressResponse>
    return getData().toArray(new MyProgressResponse[0]);
}

Now the JSON that I receive is like

[
 {
   {
     "x": 1335499200000,
     "y": 85
   }
 },
 {
   {
     "x": 1334894400000,
     "y": 84
   }
 },
 ....
]

But my requirement is to get the that does not have one extra block { }.

[
   {
     "x": 1335499200000,
     "y": 85
   },
   {
     "x": 1334894400000,
     "y": 84
   },
   ....
]

I want to use this in a HighChart. I can format the data in JS after i receive the data but it will get extra time and I dont want that.

Can anyone can help me in formatting the data

Thanks,

Talha Ahmed Khan

  • 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-02T16:37:30+00:00Added an answer on June 2, 2026 at 4:37 pm

    Change your return type of the method to ArrayList :

    @GET @Path("/my") 
    @Produces(MediaType.APPLICATION_JSON) 
    public ArrayList<MyProgressResponse> getProgressResponse(){     
    // Get the data from DB     
    // Here the getDate will give me List<MyProgressResponse>
    
    ArrayList<MyProgressResponse> response=(ArrayList<MyProgressResponse>) getData();
    
    return response; 
    } 
    

    Also make your bean class implement Serializable.

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

Sidebar

Related Questions

I'm having some trouble indexing data.frames in R. I'm an R beginner. I have
I am having trouble converting the device motion data into world coordinates. I have
I'm having trouble with some Excel data validation. On one sheet, I have a
I'm having trouble to make a simple CRUD in my site. I have a
I have some data in csv format I want to use for predictive modeling.
I have trouble wrapping my head around a peculiar feature of the JSON data
I am having some trouble with passing data of an array from one class
I have a function that returns dates in a specific format FormatDate(int PreviousMonths, int
i am having a bit of trouble with DataInputStreams, So i have data coming
I have some troubles with receiving data on server side. Here goes the code:

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.