#set ($layout="json.vm")
#set ($dummy = $dbtool)
#set ($res=${response.setContentType("application/json")})
#if($params.list)
#set ($pl=$packagelists)
#set ($res=$pl.load($params.list))
#else
#error Nö
#stop
#end
#if($params.updates)
#set($pkgs=$pl.diffPackages($pl.origin))
#elseif ($params.installed)
#set ($pkgs=$pl.getInstalledPackages())
#else
#set ($pkgs=$pl.getPackages())
#end
#set ($count=$pkgs.size())
[
#foreach ($p in $sorter.sort($pkgs,"name"))
#if ($count!=$velocityCount)
#set ($sep=",")
#else
#set ($sep="")
#end
{ "id": $p.id, "name": "$p.name", "version": "$p.version", "description": "$!p.description", "arch": "$p.arch", "install": $p.install, "list": "$params.list" }$!sep
#end
]
