Can we get getresources output to a php file as array or json string?
if you foreach iterate json alone, you have an object of objects,even if you pass it as a true parameter,if you are looping through the first parameter.
The short answer is, not easily. All MODX snippets, including getResources, return one big string. You could possibly create Tpl chunks for getResources that included delimiters and then parse the output, but it's going the long way around.
The usual solution is to create your own snippet that gets the same array of resources with getCollection() (just like getResources does). That will give you a PHP array of Resource objects, which you can loop through and create the output you want.
You can convert each resource object into an array with $resource->toArray().
You can also use Tpl chunks with $modx->getChunk('ChunkName', $fields) where $fields is an array of placeholder names and their values. Sometimes it's as easy as $fields = $resource->toArray().