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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:19:10+00:00 2026-06-04T17:19:10+00:00

Possible Duplicate: JSONkit sorting issues I have the following jSON [ { Pending: 67,

  • 0

Possible Duplicate:
JSONkit sorting issues

I have the following jSON

[
  {
    "Pending": 67,
    "Past Due": 63,
    "Invites": 0
  },
  {
    "Reading Approval": 4,
    "Schedule Approval": 16,
    "Session Assignment": 1
  },
  {
    "Reading Approval": 3,
    "Schedule Approval": 20,
    "Class Approval": 20,
    "Module Approval": 2,
    "Training Plan Review": 2,
    "Job Confirmation": 1
  }

]

When I assign the json string to a nsarray the values inside the dictionary gets sorted alphabetically.

NSArray *arr = [strResult JSONValue]; 

How can I keep the same order as the json string?

arr = 
{
  Invites = 0;
  "Past Due" = 63;
  Pending = 67;
},
{
  "Reading Approval" = 4;
  "Schedule Approval" = 16;
  "Session Assignment" = 1;
},
{
  "Class Approval" = 20;
  "Job Confirmation" = 1;
  "Module Approval" = 2;
  "Reading Approval" = 3;
  "Schedule Approval" = 20;
  "Training Plan Review" = 2;
}
)

This is the table I want to display:

Group 1
  Pending    67
  Past Due   63
  Invites    0

Group 2
  Reading Approval    4
  Schedule Approval   16
  Session Assignment  1

Group 3
  Reading Approval      3
  Schedule Approval     20
  Class Approval        20
  Module Approval       2
  Training Plan Review  2
  Job Confirmation      1
  • 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-04T17:19:12+00:00Added an answer on June 4, 2026 at 5:19 pm

    Using standard JSON parsers, you will need to change your data.

    [
      [
        { "Pending": 67 },
        { "Past Due": 63 },
        { "Invites": 0 }
      ],
      [
        { "Reading Approval": 4 },
        { "Schedule Approval": 16 },
        { "Session Assignment": 1 }
      ],
      [
        { "Reading Approval": 3 },
        { "Schedule Approval": 20 },
        { "Class Approval": 20 },
        { "Module Approval": 2 },
        { "Training Plan Review": 2 },
        { "Job Confirmation": 1 }
      ]
    ]
    

    Assuming it’s possible for you to change your JSON format.


    How to access the data. Assuming you have the array of sections and know the section and row indexes.

    NSArray *sections = ...
    NSUInteger sectionIndex = ...
    NSUInteger rowIndex = ...
    
    NSArray *rows = [sections objectAtIndex:sectionIndex];
    NSDictionary *cell = [rows objectAtIndex:rowIndex];
    
    NSString *name = [[cell allKeys] objectAtIndex:0];
    NSNumber *value = [cell objectForKey:name];
    
    // What ever you need to do
    

    If you want to iterate over all the data

    NSArray *sections = ...
    
    for (NSArray *rows in sections) {
        for (NSDictionary *cell in rows) {
            NSString *name = [[cell allKeys] objectAtIndex:0];
            NSNumber *value = [cell objectForKey:name];
    
            // What ever you need to do
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: When do you use the “this” keyword? If I have the following
Possible Duplicate: regex for URL including query string I have a text or message.
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: Matlab gives wrong answer Can anyone explain to me why the following
Possible Duplicate: Why do I get a null pointer exception from TabWidget? I have
Possible Duplicate: Python urllib2 Progress Hook I have a script which uploads a file
Possible Duplicate: Split A4 PDF page into two A5 and back again I have
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: Singleton: How should it be used Following on from Ewan Makepeace 's

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.