As I said, xPDO will never get JSON data unless there is JSON data in the MODX database.
It sounds like you're creating your own API. Are you asking how to get TV values and return them in JSON format from your API?
This would be one way:
Put a snippet tag on a page with an empty template:
Then create a snippet called GetTvs with this code:
/* GetTvs snippet */
$tvIds = array(12,22,31); // Id's of the TVs you want to get
$resourceId = 8; // ID or resource you want the TV values fromf
$data = array(0;
foreach ($tvs as $tvId) {
$tv = $modx->getObject('modTemplateVar', $tvId);
if ($tv) {
$tvValue = $tv->renderOutput($resourceId);
$tvName = $tv->get('name');
$data[$tvName] = $tvValue;
} else {
/* TV not found -- handle error */
}
}
$data = $modx->toJSON($data);
echo $data;