How to create a custom query inside a plugin in Craft? Can you give an example of returning entries from a section in JSON format using a custom query?
Easy enough:

$query = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$query-&gt;section = 'mySection';
$results = $query-&gt;find();


You can obviously refine the query before calling find():

$query-&gt;limit   = null;
$query-&gt;myCustomField = 'value';