constructing json from views