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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:39:13+00:00 2026-06-06T22:39:13+00:00

This feels like a super newb question, so apologizes in advance. How does one

  • 0

This feels like a super newb question, so apologizes in advance.

How does one specify booleans when using NSJSONSerialization?

My current code is below:

NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys: 
                            value, @"key",
                            NO, @"booleanKey",
                            nil];

NSData *jsondata = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSString *jsonString = [[NSString alloc] initWithData:jsondata encoding:NSUTF8StringEncoding];

It just seems to be ignoring it and the NSLog output looks like:

{"key":"THE VALUE OF id value"}
  • 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-06T22:39:15+00:00Added an answer on June 6, 2026 at 10:39 pm

    The reason that it is getting ignored is because NO is the same as nil, which terminates your dictionary list. You can only add objects into your dictionary, thus turn any primitive types into objects. E.g.: NO turns to [NSNumber numberWithBool:NO] or if you are using Xcode 4.4 you can just use @(NO).

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

Sidebar

Related Questions

This feels like a really basic question, but I can't figure it out anyway..
OK, this feels like an idiot question, but I'm stuck - I don't know
This feels like it should be pretty simple, but not much seems to be
This feels like the kind of code that only fails in-situ, but I will
It feels like there must be some semi-simple solution to this, but I just
My string looks like this $string_value = /hello/world/this/feels/great/ how can I trim world and
Earlier this week, I had to do something which feels like a semantics violation.
I generally do something like this, but if feels nasty and not very dry:
edited for clarity I feel like this question already has an answer, but I
I've been trying to fix this problem almost all day (or it feels like

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.