how can i create json from a table and related table to be something like this : "items":
Use the PHP function json_encode($value) on your rows.
and ? this make a $users->precreateComments() to show like a nested json, with table at the first and related table as nested json?