Resources

Getting a JSON output

light fare

JSON Listing Output

Sometimes the standard output of listing snippets like getResources isn't what you need. What if you need an array, or a JSON string?

Hitesh asked...

Can we get getResources output to a php file as array or json string?

The Solution:

Bruno17 says...

migxLoopCollection has a &toJsonPlaceholder - property

[[!migxLoopCollection?
  &classname=`modResource`
  &where=`{"parent:IN":[1,2,3],"deleted":"0","published":"1"}`
  &toJsonPlaceholder=`myplaceholder`
]]

Then you can use that placeholder in your snippet and do what you want with it.

What's the Story?

If one snippet won't solve your problem, there is almost always another one that will. Bruno's MIGX package includes a number of very useful snippets, even if you don't want to use the MIGX custom TVs.