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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:26:35+00:00 2026-06-13T02:26:35+00:00

How do I get image data out of JSON returned by a WCF Data

  • 0

How do I get image data out of JSON returned by a WCF Data Service?

I’ve got a WCF Data Service serving some objects that include some binary data that is an image (column type in SQL Server is image). It comes across as text gibberish in the JSON. In the iOS client I’m writing for this service, I want to display this data as an image ([UIImage imageWitData:myData]).

Here is what I’m doing:

NSData *networkData = nil; //assume this magically gets data from the service
NSError *err = nil;
//assume the returned JSON has one object and is not an array
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:networkData
     options:NSJSONReadingAllowFragments error:&err];

//handle error if needed

NSString *imageString = [dict objectForKey:@"Image"];
NSData *imageData = [imageString dataUsingEncoding:NSUTF8StringEncoding];
///The service is using UTF-8.
UIImage *image = [UIImage imageWithData:imageData];

Putting that image in a UIImageView doesn’t show anything. What am I doing wrong?

  • 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-13T02:26:37+00:00Added an answer on June 13, 2026 at 2:26 am

    Turns out that binary data returned from WCF Data Services is base64 encoded. I’m using the NSData-Base64 category to parse it, and it’s working great. So the solution looks like this:

    NSData imageData = [NSData dataFromBase64String:imageString];
    

    When I imported those files into my project ARC threw up some errors, but I was able to solve them by removing a couple of autorelease calls in the .m file.

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

Sidebar

Related Questions

Possible Duplicate: Get image data in Javascript? Convert an image into binary data in
I have some divs that are created with data from a json string. Most
I'm using Loader to get the image data out of a ByteArray. The problem
I need to get the JSON object data out of the callback function so
Hi friends, I am trying to get the string data and image data from
I got images in a php includes file. <img class=imgmove src='data:image/png;base64,<?php echo base64_encode(file_get_contents(images/form/firstname.png)); ?>'>
I've got a view in Django that uses memcached to cache data for the
I have created a function that loops through a set of returned JSON. I
Hi, i have been having some problems using JSON data in flash builder lately
I'm trying to create an API that spits out JSON in Flask using MongoDB.

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.