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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:18:18+00:00 2026-05-30T16:18:18+00:00

I am creating some JSON data to be validated through an ajax call. Here’s

  • 0

I am creating some JSON data to be validated through an ajax call.

Here’s my constructed JSON :

{"telephone1":"66",
 "telephone2":"66",
 "fax":"66",
 "mobilePhone":"66",
 "dateEffectiveChangementAdresseOuTel":"66",
 "adresse1IdentiqueAdresse2":true}

Here’s the one obtained :

{ "adresse1IdentiqueAdresse2" : true,
  "dateEffectiveChangementAdresseOuTel" : "66",
  "fax" : "66",
  "mobilePhone" : "66",
  "telephone1" : "66",
  "telephone2" : "66"
}

As you can notice, my key are reordered in alphabetical order, which I do not want.

This causes errors to be returned to the page in the 2nd order, but I need them in the 1st order. I want my error summary (Html.ValidationSummary) to follow the errors on the page (1st error = 1st field in error).

Is there any way to preserve my original order?
Or someway to bypass this?

edit

        var coord = {
            telephone1: $("#Telephone1").val(),
            telephone2: $("#Telephone2").val(),
            fax: $("#Fax").val(),
            mobilePhone: $("#MobilePhone").val(),
            dateEffectiveChangementAdresseOuTel: $("#DateEffectiveChangementAdresseOuTel").val(),
            adresse1IdentiqueAdresse2: $("#Adresse1IdentiqueAdresse2").is(":checked")
        };

        $.ajax({
            type: 'POST',
            url: urlControleur + '_ActionTransmettre',
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            data: JSON.stringify(coord),
            success: function (data, textStatus, jqXHR) {
                if (typeof (data) == "string") {
                    window.location = data
                    MsgErreur("");
                }
                else {
                    ListeMsgErreur(data);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                handleAjaxError(XMLHttpRequest, "M000017");
            }
        });

ajax call return (in error)

["The value {0} is not valid for Effective.",
"Le numéro saisi doit respecter le format 999 999-9999",
"Le numéro saisi doit respecter le format 999 999-9999",
"Le numéro saisi doit respecter le format 999 999-9999 ou, si vous devez saisir un numéro de poste, le format est 999 999-9999 x 9999999.",
"Le numéro saisi doit respecter le format 999 999-9999"]

It’s impossible to reorder the return as is.

  • 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-30T16:18:19+00:00Added an answer on May 30, 2026 at 4:18 pm

    I would review the code that returns the json. this is where it’s happening. if you cannot change the code which renders the JSON then remodel the data before passing it along

    return {
       telephone1: theJson.telephone1,
       telephone2: theJson.telephone2,
       fax: theJson.fax,
       mobilePhone: theJson.mobilePhone,
       dateEffectiveChangementAdresseOuTel: theJson.dateEffectiveChangementAdresseOuTel,
       adresse1IdentiqueAdresse2: thsJson.adresse1IdentiqueAdresse2
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a program that gets data from a server using AJAX/JSON and then
All, I'm creating some JSON arrays by looping through my database and populating some
Some information - I'm creating an autocomplete which gets the data from a json
I'm creating a JSON REST API (lots of caps there), and already have Data.Aeson.Generic
I have a user control that I'm creating that is using some AJAX in
I have a request.json in mootools to get some data from a php function
I'm returning data from our database and creating a table dynamically. If the call
My app currently requests a JSON file with some text and other data from
There are some ideas for creating a dropdown menu from data populated from xml
I'm running Sitecore 6.4 and trying to get some data using ajax and webmethod

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.