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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:17:46+00:00 2026-06-03T01:17:46+00:00

Im developing an Android application which are using an webservice to fetch an image

  • 0

Im developing an Android application which are using an webservice to fetch an image that are going to be displayed in the application.

I’m using JSON as my format. The whole connection process works like a charm but i need help with parsing the response from the webservice request.

This is my result:

[255,12,87,183,232,34,64,121,182,23]

Of course this is not the real data, im just trying to explain how the data looks like when i receive it. So my question is, how do i parse this data into an byte array?

Here is my connection code this far:

HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
InputStream stream = responseEntity.getContent();
String string_result= convertStreamToString(stream);

This works great and the variable ‘string_result’ contains the data that was received.
So if someone know how to simply parse this JSON String Containing An Byte Array i would appreciate some help.

  • 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-03T01:17:47+00:00Added an answer on June 3, 2026 at 1:17 am

    Here is an example of parsing this array to byte[] using the irreplaceable GSON library:

    String str = "[255,12,87,183,232,34,64,121,182,23]";
    Gson gson = new Gson();
    byte[] parsed = gson.fromJson(str, byte[].class);
    for (byte b : parsed) {
        System.out.println(b);
    }
    

    This code outputs:

    -1
    12
    87
    -73
    -24
    34
    64
    121
    -74
    23
    

    Note that the java byte is signed and thus you get the negative numbers.

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

Sidebar

Related Questions

I'm developing an Android application that makes a Query using Activity.managedQuery() , which takes
I'm currently developing an Android application that fetches images using http requests. It would
I am developing an android application , in which i am using a gif
I'm developing one android application in which I'm using one customized ListView which extends
I am developing an Android application in which the user logs in using its
I am developing an application which is using facebook sdk for android to log
I am developing an application for the Android platform which contains 1000+ image filters
I am developing an android application in which I have to upload image from
I am developing an android application, in which I have to upload image to
We've been developing an Android application which includes Google Adsense. However there seems to

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.