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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:11:57+00:00 2026-05-31T16:11:57+00:00

I have the following JSON data being returned, but for some reason, Javascript or

  • 0

I have the following JSON data being returned, but for some reason, Javascript or jQuery ajax seems to re-organise the items list. The server returns the data sorted alphabetically by item.title (verified)…

The JSON below is after the ordering has been butchered:

   {
        "count": 3,
        "items": {
            "tardis": {
                "type": 40,
                "title": "Tardis",
                "timeMachine": true,
                "reliable": true
            },
            "stargate": {
                "type": "Milky way gate",
                "title": "Stargate + solar flare",
                "timeMachine": true,
                "reliable": false
            }
        }
    }

Does anyone why the ordering is being tampered with? How can I re-order the items byt the title 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-05-31T16:11:58+00:00Added an answer on May 31, 2026 at 4:11 pm

    Your items object is not an array, but just an object with named members. These members have no inherent order.

    For instance, doing a console.log({ your object }) in chrome will yield the properties sorted by the member name, in this case “stargate” and “tardis”, in that order. But writing for(k in x.items) console.log(k) for the exact same object, will (in Chrome – again, no reliable specification here) iterate over the objects in the order they were defined, and log “tardis”, “stargate”.

    This ordering is an artifact of how an object is presented, not of the object itself. Use arrays if you want ordering:

    {
        "count": 3,
        "items": [
            {
                "key": "stargate",
                "type": "Milky way gate",
                "title": "Stargate + solar flare",
                "timeMachine": true,
                "reliable": false
            },
            {
                "key": "tardis",
                "type": 40,
                "title": "Tardis",
                "timeMachine": true,
                "reliable": true
            }
        ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following javascript: $.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: {
I have the following JSON data being returned by a webservice: {d:[ {RelationshipManager:{},AdvisoryId:13,ClientId:22,UserId:13,AdvisoryMessage:Welcome!,Seen:false,Issued:\/Date(1312123970110)\/,Delivered:null,Importance:3}, {RelationshipManager:{},AdvisoryId:14,ClientId:22,UserId:13,AdvisoryMessage:A
A] Problem summary: I have JSON data being returned from python to javascript. I
I have the following code: jQuery: $.ajax({ url: '/personcontroller/getperson', cache: false, type: POST, data:
I have date data being returned from a server in the following format through
I have defined an ajax dataFilter for my jQuery calls that return JSON data
I have some Json being returned from facebook which I'm then parsing in to
I have some code that requests some JSON from an API. When data is
I have the following PHP script being called by AJAX: <?php // file /ajax/loopback.php
I have a form being AJAX'd in by jQuery on a page with multiple

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.