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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:45:49+00:00 2026-06-06T10:45:49+00:00

I am using jQuery widgets in a Joomla application. The data for the widget

  • 0

I am using jQuery widgets in a Joomla application. The data for the widget must an object and in json format. I am able to achieve that when I retrieve the data direct from the database without the database functionality of the Joomla framework.

Of course, I do want to do it within the Joomla MVC structure and I want to utilise the Joomla database functions. When doing it there is no output in the widget.

I had this before that when passed as an array, it does not display the data, when passed as an object, it does.

My problem is this:
Generating the data directly from the database and using the Joomla database structure produces exactly the same result when echoed to the screen but one is displayed in the grid and the other isn’t. That was also the case with the previous problem which I had but in that case I called json_encode twice on the same data but there was absolutely no difference in the displayed data, but one works and the other doesn’t.

My question:
I am not that familiar with JSON data yet but is there a way to check whether the data is represented as an object or an array? This maybe a very dumb question but it seems to me that there must be a difference in the data and by simply looking at it, you are not able to see it, or am I missing something?

UPDATE:
Thanks for the responses. I have sat on this for days!! It is working now with the Joomla database functions, it seems there was a minor issue with my code apart from the json encoding but they looked exactly like this when I used the json_encode both in the model and the controller before, therefore double json encoding it, which did not work but when generated outside of Joomla, it worked (single use of json_encoding). Looking at them generated outside of Joomla and after a double json encoding, both of the looked the same, therefore I could not found the problem looking at the output, the same as now.

Thanks for the info regarding the [] and {}, that is insightful but here is an example of my code:

   [{"TotalRows":2,"Rows":[{"login_id":"122","cust_id":"0","shop_id":"0","nickname":null,"shopicon":null,"website":null,"shopname":null, "username":"","password":"","dob":"0000-00-00","comments":null},
{"login_id":"25","cust_id":"57","shop_id":"42","nickname":"qwerty","shopicon":"shop.ico","website":"http:\/\/www.shop.co.uk","shopname":"Shop","username":"eqweq","password":"wqewqeq","dob":"1981-12-14","comments":"qwqeqeqw"}]}]

How can I tell from this whether it is an array or an object?

  • 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-06T10:45:52+00:00Added an answer on June 6, 2026 at 10:45 am

    If you have JSON string, you can simply check if first non-whitespace symbol is { or [. { would mean that top level is regular object (remember that arrays are objects too!), [ – array. You can also parse it to object and check if instanceof Array is true for the result.

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

Sidebar

Related Questions

I have created a slideshow widget, using jQuery.UI widgets that works with window.setInterval. I
I will be using jQuery's functionality to create portlet widgets for my web application
I have created HTML TABLE from JSON data of PHP using JQuery. After creating
I get that when developing a jQuery UI widget one must override destroy and
Context: HTML widgets generated using a Django ModelForm and template, jQuery 1.3.2, JavaScript on
I am using the jQuery dialog widget with the modal option over a wordpress
I'm going over the jquery widget here: http://blog.davidpadbury.com/2010/10/11/bdd-testing-of-jquery-plugins-using-jasmine/ The plugin is called like so:
I am using the Jquery UI Tabs widget and my Tab is collapsible and
I'm using jQuery Tablesorter with Zebra widget on multiple tables. What i'm trying to
I'm using the jQuery UI Button widget to style all the buttons on my

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.