Welcome, Guest
Username: Password: Remember me

TOPIC: JSON output from my component?

JSON output from my component? 06 Dec 2012 14:10 #5863

  • gdpodesta
  • gdpodesta's Avatar
  • Offline
  • Senior Member
  • Posts: 75
  • Thank you received: 8
  • Karma: -42
Posted this in the wrong forum earlier, so reposting here assuming the other will be removed. I've been googling this, and have several vague answers, generally about earlier versions of Joomla.

My component needs to interact with another system that we have, so I'm trying to accomplish "api-like" functionality such as something like this example of other system getting total hits on a particular record in my Cook component:
index.php?option=com_mycomponent&view=MyApiView&layout=GetHits&MyParm=1234
It is my hope (in addition to all the normal layouts/views) that my component will be able to return only valid JSON output something like this that can be used in the jQuery of the other system that record ID 1234 has had 75 hits:
{
  "MyParm": "1234",
  "totalhits": "75"
  "lasthit": "2012-12-05 13:05:47"
}
Is there any hope that there is some magic "sweet spot" in the Cook code that could help me get there quicker than sifting through all these Google results and trying to apply them to the generated code?
Last Edit: 06 Dec 2012 15:23 by gdpodesta. Reason: Better example relative to cook
The administrator has disabled public write access.

Re: JSON output from my component? 07 Dec 2012 17:15 #5901

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin
Time to create page: 0.933 seconds

Get Started