Add loading on pagination action and fix json formatting