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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:15:17+00:00 2026-06-11T21:15:17+00:00

Thanks for any help with the following: I’m loading the following JSON data ..

  • 0

Thanks for any help with the following:

I’m loading the following JSON data ..

(
    {
    name = Facilities;
    versiondate = "1972-01-01";
},
    {
    name = Services;
    versiondate = "1972-01-01";
},
    {
    name = ThingsToDo;
    versiondate = "1972-01-01";
}
)

into the following code:

NSMutableDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:updateData options:kNilOptions error:&errorString];

I am then trying to iterate over the Dictionary and trying to change the versiondate to today’s date. I have spent over two hours trying to do this … and no luck! I’m fighting with trying to also understand MutableCopies etc. I’m relatively new at this …

So, I’m trying the following:

for (NSMutableDictionary *item in dictionary)
{
    NSMutableDictionary *newdict = [item mutableCopy];
    NSLog(@"I have item as: %@",newdict);
    NSLog(@"I have the date as: %@", [newdict objectForKey:@"versiondate"]);
    [newdict setObject:[NSDate date] forKey:@"versiondate"];
    NSLog(@"I now have the date as: %@", [newdict objectForKey:@"versiondate"]);
    NSLog(@"I have item as: %@",newdict);
    item = newdict;
}

NSLog(@"New Dictionary now becomes: %@", dictionary);

And ignoring the NSLog stuff, I’m having no luck. I’m just trying to change the versiondate to today’s date and then save it for each versiondate. Sigh.

Any help to tell me where my “obvious” error is would be appreciated. I’m declaring item as NSMutableDictionary … so why do I have to then define newdict? And once I’ve updated the value, how do I “save” this back into my original dictionary?

  • 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-11T21:15:19+00:00Added an answer on June 11, 2026 at 9:15 pm

    If you want mutable dictionaries and arrays when you deserialize the JSON, pass the option NSJSONReadingMutableContainers. Otherwise, what comes out is not mutable. And treating it as such will result in the NSInternalInconsistencyException you’re seeing.

    You can create mutable copies of the sub-dictionaries, as in the code you show, but that doesn’t change the original top-level container’s contents. (And assigning the copy back to the original variable at the bottom of your loop accomplishes exactly nothing.)

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

Sidebar

Related Questions

Sample data: I can flatten out parent-child relationship using this query.... Any help... Thanks
Thanks for any help in advance, I can't wrap my SQL skills around this
Still learning WPF....thanks for any help. Is there any way to Refactor this: <ListBox
Thanks in advance for any help you can provide on this issue! I manage
I am using c# .net. Thanks in advance for any help. I have searched
Thanks for any help offered. I deployed my application in server and I am
Hello all and thanks for any help in advance. I have a ruby on
i have very serious problem if any tech expert can help...thank you in advance..
i've been asked this question and id not know the answer. Thanks for any
As title Welcome any comment Thanks interdev

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.