Fixed assertions bug when writing out json with empty array.