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

  • Home
  • SEARCH
  • 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 8361113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:37:40+00:00 2026-06-09T11:37:40+00:00

In a WebService JSON response is coming. In the response, there is image is

  • 0

In a WebService JSON response is coming. In the response, there is image is coming as a byte array. I have to show the image in a UIImageView. I am trying to convert the byte array to NSData. But not getting how to do that. Any help would be appreciated.
I am confident that the byte array has image data in it.
Sample Byte array for your reference:

unsigned char array = {
            137,
            80,
            78,
            71,
            ...
            66,
            96,
            130
};

Thanks

  • 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-09T11:37:41+00:00Added an answer on June 9, 2026 at 11:37 am

    You have to convert the JSON to an array of strings first; you can, for example, use the NSJSONSerialization class:

    NSArray *strings = [NSJSONSerialization JSONObjectWithData:theJSONString options:kNilOptions error:NULL];
    

    Then walk the strings array, convert each entry to an integer, and add it to an allocated byte pointer/array:

    unsigned c = strings.count;
    uint8_t *bytes = malloc(sizeof(*bytes) * c);
    
    unsigned i;
    for (i = 0; i < c; i++)
    {
        NSString *str = [strings objectAtIndex:i];
        int byte = [str intValue];
        bytes[i] = byte;
    }
    

    Then finally make an NSData out of the bytes, then init an UIImage object using it:

    NSData *imageData = [NSData dataWithBytesNoCopy:bytes length:c freeWhenDone:YES];
    UIImage *image = [UIImage imageWithData:imageData];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to get only JSON response from a webservice. i am getting
Im trying to get a response from a function in a webservice but i
I have a webservice url that retrieve a JSON as response.I need to send
I am trying to parse a Json response from my webservice. I receive this
I want to create a .NET webservice using C# with JSON. but I've error
I'm trying to get a JSON from a webservice with javascript $.Ajax call. <script
I have ASP.NET page, it calls webservice via $.ajax and returns result in json
I've create a .NET web service with JSON. but the result didn't show as
I have validated the JSON response from my C# Webmethod, so I don't believe
I am retrieving a byte array of a pictureStream from a .net webservice. the

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.