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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:40:23+00:00 2026-06-17T23:40:23+00:00

My iphone app is accessing a JSON service which returns something like: {theResult:{Total:1.5, Comment:some

  • 0

My iphone app is accessing a JSON service which returns something like:

{"theResult":{"Total":1.5, "Comment":"some comment"}}

The code I’m using successfully parses any NSStrings such as the comment field above but I am having trouble with numeric values.

NSDictionary *res= [json objectForKey:@"theResult"];
NSString *comment = [res objectForKey:@"Comment"];
NSDecimal *total = (__bridge NSDecimal *)[res objectForKey:@"Total"]; 

The *total variable does not get set correctly and causes a EXC_BAD_ACCESS error.

How do I parse numeric values in objective-c?

  • 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-17T23:40:25+00:00Added an answer on June 17, 2026 at 11:40 pm

    convert the object to the correct data type, like this

    float total = [[res objectForKey:@"Total"] floatValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an iPhone native app using the JSON framework. My app is accessing
Accessing Web Services inside an iPhone app is a matter for which I did
i want to make my iphone app can connect to some webdav server using
My iPhone app is crashing and getting EXC_BAD_ACCESS error when using this code: NSError
In my iPhone app I am accessing a WordPress powered blog using XML-RPC WordPress
My iPhone app can't seem to use soft keyboards that doesn't use the US-like
My iphone app called Google Local Search(non javascript version) to behave some search business.
My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen
I have an iPhone app accessing an ASP.NET Webservice for data. Since I'm building
I'm researching how to code an iPhone app that needs to connect to an

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.