Add test on json query
Fix ordering