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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:04:32+00:00 2026-06-16T00:04:32+00:00

I think I get it how to use the NSJSONSerialization over all. The call

  • 0

I think I get it how to use the NSJSONSerialization over all. The call I am making is:

[NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error]

where parameters is a NSDictionary which includes keys and values to use in the JSON request. Everything is fine and all, until I have to use null as a value instead of an empty string. I can’t find a way to set the value as null at all. The example of json that I need to create is:

{"target"
  {"firstname":<firstname>,
   "lastname":<lastname>},
 "error":null
}

The way server is setup is that it’s expecting either an error as a string or a null if there’s no error.

Any ideas? Am I missing an API call or something like that?

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-16T00:04:33+00:00Added an answer on June 16, 2026 at 12:04 am

    You have to use NSNull. For instance

    Swift

    let dict = ["firstKeyHasValue": 2342, "secondKeyHasNoValue": NSNull()]
    

    Objective-C

    NSDictionary *dict = @{ @"error": [NSNull null] };
    

    From the official documentation of NSDictionary:

    Neither a key nor a value can be nil; if you need to represent a null value in a dictionary, you should use NSNull.

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

Sidebar

Related Questions

I have an ajax call (JSONP) using JQuery with GET method. I think because
I think I get the basics of multi-threading with Java. If I'm not mistaken,
OK I think I get Difference between jQuery.extend and jQuery.fn.extend? in that the general
I am new to sessions, and think I get the basics of them, they
This is a practical Domain Driven Design question: Conceptually, I think I get Aggregate
I'm beginning to think that to get a ProgressDialog to work the AsyncTask has
I think i was doing halfway good to get this to halfway work. Anyways
I think something buggy is up with my GET method as I am getting
I think that handlers in android are tools to get different objects that are
Do you think jquery could help me get the following script work faster? Thanks!

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.