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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:40:11+00:00 2026-06-16T03:40:11+00:00

Grabbing an JSON array from a query. It’s not printing the keyss with in

  • 0

Grabbing an JSON array from a query. It’s not printing the keyss with in the data.

What I expect:

["0":"3675E5010E2738","1":"4114009","2":"2012-11-05","3":"Active","4":"2012-12-11"]

What I get…

["3675E5010E2738","4114009","2012-11-05","Active","2012-12-11"]

JSON is produced from PHP/JSON encode:

$array = $model->ListData();
echo json_encode($array);

I’ve tried loading both loadRowList(); and loadAssocList(); and neither produce the keys.

  • 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-16T03:40:12+00:00Added an answer on June 16, 2026 at 3:40 am

    Because that’s not how JSON represents arrays

    ["0":"3675E5010E2738","1":"4114009","2":"2012-11-05","3":"Active","4":"2012-12-11"] is not valid JSON.

    {"0":"3675E5010E2738","1":"4114009","2":"2012-11-05","3":"Active","4":"2012-12-11"} is, but that’s the representation of an object, not an array.

    If $model->ListData(); returns an array, as your code suggests that it does, then the representation that you’re getting is correct.

    Anyway, since json[0] would work the same way, regardless of whether it was an array or an object with numerical keys, what does it matter?

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

Sidebar

Related Questions

Trends data from Twitter Search API in JSON. Grabbing the file using: $jsonurl =
I have the following code grabbing a JSON object from github and I am
I'm grabbing some json from here on freebase (careful, you can only request this
I'm have trouble grabbing the response JSON data that's returned via AJAX call. Here
I am grabbing a JSON response from AJAX request, the output is something like
My iPhone app is grabbing a JSON object from a PHP website. The object
I'm grabbing JSON object from an URL and parsing it with JSON.NET. I was
i have a rails controller grabbing some data from mongodb. the field i'm interested
I am trying to parse JSON from a URL to then add data to
I'm grabbing some JSON from YQL, parsing it into a list. Then I want

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.