Returning json in REST API. Added logged-in check.