change json to be ordered by array